From 4dc37bcee080ed79347b4d4a2b34ff843293ff5c Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 5 Sep 2016 10:34:34 -0700 Subject: [PATCH] Ignore repository versions on inactive devices in "Repository Servers" panel in Config Summary: Fixes T11590. Currently, we incorrectly consider cluster repository versions that are (or were) on devices which are no longer part of the active cluster service when building this status screen. Instead, ignore them. This is just a display bug; the actual `ClusterEngine` already had similar logic. Test Plan: - Added a bad leader record to `repository_workingcopyversion`. - Before patch, got a bad "Partial (1w)" sync: {F1802292} - After patch, got a good "Sycnchronized": {F1802293} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11590 Differential Revision: https://secure.phabricator.com/D16492 --- .../PhabricatorConfigClusterRepositoriesController.php | 8 ++++++++ .../protocol/DiffusionRepositoryClusterEngine.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/applications/config/controller/PhabricatorConfigClusterRepositoriesController.php b/src/applications/config/controller/PhabricatorConfigClusterRepositoriesController.php index a61f0e3535..b3fd9915b1 100644 --- a/src/applications/config/controller/PhabricatorConfigClusterRepositoriesController.php +++ b/src/applications/config/controller/PhabricatorConfigClusterRepositoriesController.php @@ -153,6 +153,14 @@ final class PhabricatorConfigClusterRepositoriesController $versions = idx($repository_versions, $repository_phid, array()); + // Filter out any versions for devices which are no longer active. + foreach ($versions as $key => $version) { + $version_device_phid = $version->getDevicePHID(); + if (empty($active_devices[$version_device_phid])) { + unset($versions[$key]); + } + } + $leaders = 0; foreach ($versions as $version) { if ($version->getRepositoryVersion() == $leader_version) { diff --git a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php index 6fa0bac9e8..3be69d356d 100644 --- a/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php +++ b/src/applications/diffusion/protocol/DiffusionRepositoryClusterEngine.php @@ -104,7 +104,7 @@ final class DiffusionRepositoryClusterEngine extends Phobject { // We identify all the cluster leaders and reset their version to 0. // We identify all the cluster followers and demote them. - // This allows the cluter to start over again at version 0 but keep the + // This allows the cluster to start over again at version 0 but keep the // same leaders. if ($versions) {