1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +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 // If the database is not available, just skip this configuration
// source. This happens during `bin/storage upgrade`, `bin/conf` before // source. This happens during `bin/storage upgrade`, `bin/conf` before
// schema setup, etc. // schema setup, etc.
} catch (AphrontConnectionQueryException $ex) { } catch (PhabricatorClusterStrandedException $ex) {
if (!$config_optional) { // This means we can't connect to any database host. That's fine as
throw $ex; // long as we're running a setup script like `bin/storage`.
}
} catch (AphrontInvalidCredentialsQueryException $ex) {
if (!$config_optional) { if (!$config_optional) {
throw $ex; throw $ex;
} }

View file

@ -1141,7 +1141,9 @@ abstract class PhabricatorStorageManagementWorkflow
// Although we're holding this lock on different databases so it could // 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 // have the same name on each as far as the database is concerned, the
// locks would be the same within this process. // 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) return PhabricatorGlobalLock::newLock($lock_name)
->useSpecificConnection($api->getConn(null)) ->useSpecificConnection($api->getConn(null))