summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2019-09-19 17:05:28 +0200
committerGitHub <noreply@github.com>2019-09-19 17:05:28 +0200
commit2640874585166c2224dbb7e2904dc9f07c75bb59 (patch)
tree6335e73f73756130b83974ac1af8ac0a1a0a9f28 /container-search
parent71988ae7d715c91464776176c616a46b459f81f4 (diff)
Revert "Clarify logic: No functional change"
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java36
1 files changed, 19 insertions, 17 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 e2719545a6a..6f775e7218e 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
@@ -232,33 +232,35 @@ public class SearchCluster implements NodeManager<Node> {
updateVipStatusOnCoverageChange(group, sufficientCoverage);
}
- private void updateVipStatusOnNodeChange(Node node, boolean nodeIsWorking) {
- if (localCorpusDispatchTarget.isEmpty()) { // consider entire cluster
- if (hasInformationAboutAllNodes())
- setInRotationOnlyIf(hasWorkingNodes());
+ private void updateVipStatusOnNodeChange(Node node, boolean working) {
+ if (usesLocalCorpusIn(node)) { // follow the status of the local corpus
+ if (working)
+ vipStatus.addToRotation(clusterId);
+ else
+ vipStatus.removeFromRotation(clusterId);
}
- else if (usesLocalCorpusIn(node)) { // follow the status of this node
- setInRotationOnlyIf(nodeIsWorking);
+ else if (localCorpusDispatchTarget.isEmpty() && hasInformationAboutAllNodes()) {
+ if (hasWorkingNodes())
+ vipStatus.addToRotation(clusterId);
+ else
+ vipStatus.removeFromRotation(clusterId);
}
}
private void updateVipStatusOnCoverageChange(Group group, boolean sufficientCoverage) {
- if ( localCorpusDispatchTarget.isEmpty()) { // consider entire cluster
- if (vipStatus.isInRotation() && sufficientCoverage)
+ boolean isInRotation = vipStatus.isInRotation();
+ if (usesLocalCorpusIn(group)) { // follow the status of the local corpus
+ if (sufficientCoverage)
vipStatus.addToRotation(clusterId);
+ else
+ vipStatus.removeFromRotation(clusterId);
}
- else if (usesLocalCorpusIn(group)) { // follow the status of this group
- setInRotationOnlyIf(sufficientCoverage);
+ else if ( localCorpusDispatchTarget.isEmpty()) {
+ if (isInRotation && sufficientCoverage)
+ vipStatus.addToRotation(clusterId);
}
}
- private void setInRotationOnlyIf(boolean inRotation) {
- if (inRotation)
- vipStatus.addToRotation(clusterId);
- else
- vipStatus.removeFromRotation(clusterId);
- }
-
private boolean hasInformationAboutAllNodes() {
return nodesByHost.values().stream().allMatch(Node::getStatusIsKnown);
}