diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php --- a/src/infrastructure/env/PhabricatorEnv.php +++ b/src/infrastructure/env/PhabricatorEnv.php @@ -252,11 +252,9 @@ // 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; } diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php --- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php +++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementWorkflow.php @@ -1141,7 +1141,9 @@ // 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))