1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Fix a couple of partition migration bugs

Summary:
Ref T11044. Few issues here:

  - The `PhutilProxyException` is missing an argument (hit this while in read-only mode).
  - The `$ref_key` is unused.
  - When you add a new master to an existing cluster, we can incorrectly apply `.php` patches which we should not reapply. Instead, mark them as already-applied.

Test Plan:
  - Poked this locally, but will initialize `secure004` as an empty master to be sure.

Reviewers: chad, avivey

Reviewed By: avivey

Maniphest Tasks: T11044

Differential Revision: https://secure.phabricator.com/D16916
This commit is contained in:
epriestley 2016-11-22 10:16:47 -08:00
parent 8c89fc38fc
commit 0ed767b967
2 changed files with 17 additions and 2 deletions

View file

@ -175,7 +175,8 @@ final class DiffusionRepositoryClusterEngine extends Phobject {
pht( pht(
'Failed to acquire read lock after waiting %s second(s). You '. 'Failed to acquire read lock after waiting %s second(s). You '.
'may be able to retry later.', 'may be able to retry later.',
new PhutilNumber($lock_wait))); new PhutilNumber($lock_wait)),
$ex);
} }
$versions = PhabricatorRepositoryWorkingCopyVersion::loadVersions( $versions = PhabricatorRepositoryWorkingCopyVersion::loadVersions(

View file

@ -826,7 +826,6 @@ abstract class PhabricatorStorageManagementWorkflow
$locks = array(); $locks = array();
foreach ($apis as $api) { foreach ($apis as $api) {
$ref_key = $api->getRef()->getRefKey();
$locks[] = $this->lock($api); $locks[] = $this->lock($api);
} }
@ -981,6 +980,21 @@ abstract class PhabricatorStorageManagementWorkflow
// up to date one at a time we can end up in a big mess. // up to date one at a time we can end up in a big mess.
$duration_map = array(); $duration_map = array();
// First, find any global patches which have been applied to ANY database.
// We are just going to mark these as applied without actually running
// them. Otherwise, adding new empty masters to an existing cluster will
// try to apply them against invalid states.
foreach ($patches as $key => $patch) {
if ($patch->getIsGlobalPatch()) {
foreach ($applied_map as $ref_key => $applied) {
if (isset($applied[$key])) {
$duration_map[$key] = 1;
}
}
}
}
while (true) { while (true) {
$applied_something = false; $applied_something = false;
foreach ($patches as $key => $patch) { foreach ($patches as $key => $patch) {