大量のレコードを Export するとメモリを食いつぶし OS ごとフリーズしてしまう不具合の修正 #1145
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
関連Issue / Related Issue
不具合の内容 / Bug
データを Export する際に対象のレコード数が多いと, メモリを食いつぶしてフリーズする
原因 / Cause
ExportData()関数にて1度のクエリで大量のデータを取得している.
このとき, メモリサイズが事前に確保されておらず, CSVファイル出力前段階でメモリ使用量が急増していた.
変更内容 / Details of Change
1度に全てのデータを処理するのではなく, クエリを複数に分割し,
各クエリで取得したデータごとに逐次CSVファイルに書き出すように修正.
なお, 1度のクエリで処理するレコード数の上限は,
modules/Vtiger/actions/ExportData.php の$exportBatchLimitにて指定(デフォルト10,000)
スクリーンショット / Screenshot
影響範囲 / Affected Area
チェックリスト / Check List
備考 / Remarks
10万点のレコードのエクスポートは本件の修正で実行できることを確認しました.
もし, 修正適用後もメモリ不足が発生する場合には, 上記$exportBatchLimitを変更してください.