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

Detect unsynchronizable repositories on multiple cluster hosts

Summary:
Ref T12613. Currently, the SVNTEST and HGTEST repositories are improperly configured on `secure`. These repositories use VCS systems which do not support synchronization, so they can not be served from cluster services with multiple hosts.

However, I've incorrectly configured them the same way as all the Git repositories, which support synchronization. This causes about 50% of requests to randomly fail (when they reach the wrong host).

Detect this issue and warn the user that the configuration is not valid.

It should be exceptionally difficult for normal installs to run into this.

Test Plan:
  - Mostly faked these conditions locally, verified that `secure` really has this configuration.
  - I'll push this, verify that the issue is detected correctly in production, then fix the config which should resolve the intermittent issues with SVNTEST.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12613

Differential Revision: https://secure.phabricator.com/D17774
This commit is contained in:
epriestley 2017-04-23 06:13:53 -07:00
parent e2a94019b1
commit 0d5538672c
2 changed files with 22 additions and 2 deletions

View file

@ -559,8 +559,7 @@ final class DiffusionRepositoryClusterEngine extends Phobject {
return false;
}
// TODO: For now, this is only supported for Git.
if (!$repository->isGit()) {
if (!$repository->supportsSynchronization()) {
return false;
}

View file

@ -1929,10 +1929,31 @@ final class PhabricatorRepository extends PhabricatorRepositoryDAO
'Cluster hosts must correctly route their intracluster requests.'));
}
if (count($results) > 1) {
if (!$this->supportsSynchronization()) {
throw new Exception(
pht(
'Repository "%s" is bound to multiple active repository hosts, '.
'but this repository does not support cluster synchronization. '.
'Declusterize this repository or move it to a service with only '.
'one host.',
$this->getDisplayName()));
}
}
shuffle($results);
return head($results);
}
public function supportsSynchronization() {
// TODO: For now, this is only supported for Git.
if (!$this->isGit()) {
return false;
}
return true;
}
public function getAlmanacServiceCacheKey() {
$service_phid = $this->getAlmanacServicePHID();
if (!$service_phid) {