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

Fix two setup issues arising from partitioning support

Summary:
Ref T11044.

  - Use shorter lock names. Fixes T11916.
  - These granular exceptions now always raise as a more generic "Cluster" exception, even for a single host, because there's less special code around running just one database.

Test Plan:
  - Configured bad `mysql.port`, ran `bin/storage upgrade`, got a more helpful error message.
  - Ran `bin/storage upgrade --trace`, saw shorter lock names.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11044, T11916

Differential Revision: https://secure.phabricator.com/D16924
This commit is contained in:
epriestley 2016-11-23 04:45:20 -08:00
parent 4dadad53ae
commit ce18a8e208
2 changed files with 6 additions and 6 deletions

View file

@ -252,11 +252,9 @@ final class PhabricatorEnv extends Phobject {
// If the database is not available, just skip this configuration
// source. This happens during `bin/storage upgrade`, `bin/conf` before
// schema setup, etc.
} catch (AphrontConnectionQueryException $ex) {
if (!$config_optional) {
throw $ex;
}
} catch (AphrontInvalidCredentialsQueryException $ex) {
} catch (PhabricatorClusterStrandedException $ex) {
// This means we can't connect to any database host. That's fine as
// long as we're running a setup script like `bin/storage`.
if (!$config_optional) {
throw $ex;
}

View file

@ -1141,7 +1141,9 @@ abstract class PhabricatorStorageManagementWorkflow
// Although we're holding this lock on different databases so it could
// have the same name on each as far as the database is concerned, the
// locks would be the same within this process.
$lock_name = 'adjust/'.$api->getRef()->getRefKey();
$ref_key = $api->getRef()->getRefKey();
$ref_hash = PhabricatorHash::digestForIndex($ref_key);
$lock_name = 'adjust('.$ref_hash.')';
return PhabricatorGlobalLock::newLock($lock_name)
->useSpecificConnection($api->getConn(null))