diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-11-15 16:17:16 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-11-15 16:17:16 +0100 |
commit | 787b7a115ad2fea0658601c3ebee6bcdb74f2550 (patch) | |
tree | 79ea97d29e6f3aea31fabf7f15c5b2f259e5c9b3 /container-search/src/main/java/com/yahoo/search/dispatch/searchcluster | |
parent | 8ece4a3e82807740081aa64ed620a4fc879696bb (diff) |
When pooling ClusterMonitors and SearchClusters you will add a cluster every time there is a reconfig.
As nothing will purge them, you both keep stuff alive forever and end up with more clusters that you have.
Hence the magic for not removing vipstatus when there are multiple clusters kick in preventing nodes being taken OOR.
Now it is using the ComponentId for identifying a cluster.
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/searchcluster')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java index b51620a978b..b8d76906f70 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java @@ -41,6 +41,7 @@ public class SearchCluster implements NodeManager<Node> { private final double minGroupCoverage; private final int maxNodesDownPerGroup; private final int size; + private final String clusterId; private final ImmutableMap<Integer, Group> groups; private final ImmutableMultimap<String, Node> nodesByHost; private final ImmutableList<Group> orderedGroups; @@ -60,13 +61,14 @@ public class SearchCluster implements NodeManager<Node> { // Only needed until query requests are moved to rpc private final FS4ResourcePool fs4ResourcePool; - public SearchCluster(DispatchConfig dispatchConfig, FS4ResourcePool fs4ResourcePool, int containerClusterSize, VipStatus vipStatus) { - this(dispatchConfig.minActivedocsPercentage(), dispatchConfig.minGroupCoverage(), dispatchConfig.maxNodesDownPerGroup(), + public SearchCluster(String clusterId, DispatchConfig dispatchConfig, FS4ResourcePool fs4ResourcePool, int containerClusterSize, VipStatus vipStatus) { + this(clusterId, dispatchConfig.minActivedocsPercentage(), dispatchConfig.minGroupCoverage(), dispatchConfig.maxNodesDownPerGroup(), toNodes(dispatchConfig), fs4ResourcePool, containerClusterSize, vipStatus); } - public SearchCluster(double minActivedocsCoverage, double minGroupCoverage, int maxNodesDownPerGroup, List<Node> nodes, FS4ResourcePool fs4ResourcePool, + public SearchCluster(String clusterId, double minActivedocsCoverage, double minGroupCoverage, int maxNodesDownPerGroup, List<Node> nodes, FS4ResourcePool fs4ResourcePool, int containerClusterSize, VipStatus vipStatus) { + this.clusterId = clusterId; this.minActivedocsCoveragePercentage = minActivedocsCoverage; this.minGroupCoverage = minGroupCoverage; this.maxNodesDownPerGroup = maxNodesDownPerGroup; @@ -194,7 +196,7 @@ public class SearchCluster implements NodeManager<Node> { node.setWorking(true); if (usesDirectDispatchTo(node)) - vipStatus.addToRotation(this); + vipStatus.addToRotation(clusterId); } /** Used by the cluster monitor to manage node status */ @@ -204,16 +206,16 @@ public class SearchCluster implements NodeManager<Node> { // Take ourselves out if we usually dispatch only to our own host if (usesDirectDispatchTo(node)) - vipStatus.removeFromRotation(this); + vipStatus.removeFromRotation(clusterId); } private void updateSufficientCoverage(Group group, boolean sufficientCoverage) { // update VIP status if we direct dispatch to this group and coverage status changed if (usesDirectDispatchTo(group) && sufficientCoverage != group.hasSufficientCoverage()) { if (sufficientCoverage) { - vipStatus.addToRotation(this); + vipStatus.addToRotation(clusterId); } else { - vipStatus.removeFromRotation(this); + vipStatus.removeFromRotation(clusterId); } } group.setHasSufficientCoverage(sufficientCoverage); |