mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Fix patch 131 for db with lots of revisions
Summary: The old version of this loads all differential revisions at once, but that much can't all be loaded into memory when there are close to 500,000 revisions. This diff splits up loading the revisions. Test Plan: Ran this to run the migration in our install Reviewers: jungejason, epriestley Reviewed By: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D2243
This commit is contained in:
parent
283fee7c0a
commit
1ea8bd3ab7
1 changed files with 22 additions and 19 deletions
|
@ -19,10 +19,12 @@
|
||||||
$table = new DifferentialRevision();
|
$table = new DifferentialRevision();
|
||||||
$conn_w = $table->establishConnection('w');
|
$conn_w = $table->establishConnection('w');
|
||||||
|
|
||||||
$revisions = id(new DifferentialRevision())->loadAll();
|
echo "Migrating revisions";
|
||||||
|
do {
|
||||||
|
$revisions = id(new DifferentialRevision())
|
||||||
|
->loadAllWhere('branchName IS NULL LIMIT 1000');
|
||||||
|
|
||||||
echo "Migrating ".count($revisions)." revisions";
|
foreach ($revisions as $revision) {
|
||||||
foreach ($revisions as $revision) {
|
|
||||||
echo ".";
|
echo ".";
|
||||||
|
|
||||||
$diff = $revision->loadActiveDiff();
|
$diff = $revision->loadActiveDiff();
|
||||||
|
@ -40,5 +42,6 @@ foreach ($revisions as $revision) {
|
||||||
$branch_name,
|
$branch_name,
|
||||||
$arc_project_phid,
|
$arc_project_phid,
|
||||||
$revision->getID());
|
$revision->getID());
|
||||||
}
|
}
|
||||||
|
} while (count($revisions) == 1000);
|
||||||
echo "\nDone.\n";
|
echo "\nDone.\n";
|
||||||
|
|
Loading…
Reference in a new issue