summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-09-19 19:16:26 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-09-19 19:16:26 +0200
commit7b64e79d96cf9b3f61bd385f0a32e9454a4ef3d2 (patch)
tree1dd0d53aaad86b5c0e0c1513f5e2013c4025df53 /container-search
parent8d34d79266b612da690a347608653b59f23b46c6 (diff)
Revert "Merge pull request #10735 from vespa-engine/revert-10732-bratseth/clarify"
This reverts commit 925ad2648e24ca0db15054beb7450f209712e404, reversing changes made to 71988ae7d715c91464776176c616a46b459f81f4.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java36
1 files changed, 17 insertions, 19 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 6f775e7218e..e2719545a6a 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,35 +232,33 @@ public class SearchCluster implements NodeManager<Node> {
updateVipStatusOnCoverageChange(group, sufficientCoverage);
}
- 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);
+ private void updateVipStatusOnNodeChange(Node node, boolean nodeIsWorking) {
+ if (localCorpusDispatchTarget.isEmpty()) { // consider entire cluster
+ if (hasInformationAboutAllNodes())
+ setInRotationOnlyIf(hasWorkingNodes());
}
- else if (localCorpusDispatchTarget.isEmpty() && hasInformationAboutAllNodes()) {
- if (hasWorkingNodes())
- vipStatus.addToRotation(clusterId);
- else
- vipStatus.removeFromRotation(clusterId);
+ else if (usesLocalCorpusIn(node)) { // follow the status of this node
+ setInRotationOnlyIf(nodeIsWorking);
}
}
private void updateVipStatusOnCoverageChange(Group group, boolean sufficientCoverage) {
- boolean isInRotation = vipStatus.isInRotation();
- if (usesLocalCorpusIn(group)) { // follow the status of the local corpus
- if (sufficientCoverage)
+ if ( localCorpusDispatchTarget.isEmpty()) { // consider entire cluster
+ if (vipStatus.isInRotation() && sufficientCoverage)
vipStatus.addToRotation(clusterId);
- else
- vipStatus.removeFromRotation(clusterId);
}
- else if ( localCorpusDispatchTarget.isEmpty()) {
- if (isInRotation && sufficientCoverage)
- vipStatus.addToRotation(clusterId);
+ else if (usesLocalCorpusIn(group)) { // follow the status of this group
+ setInRotationOnlyIf(sufficientCoverage);
}
}
+ private void setInRotationOnlyIf(boolean inRotation) {
+ if (inRotation)
+ vipStatus.addToRotation(clusterId);
+ else
+ vipStatus.removeFromRotation(clusterId);
+ }
+
private boolean hasInformationAboutAllNodes() {
return nodesByHost.values().stream().allMatch(Node::getStatusIsKnown);
}