summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-09-19 08:12:28 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-09-19 08:12:28 +0200
commitfc6dac6465665fe408362a8acb7a4be9b4667e55 (patch)
tree29f6a78122a580043366198a2ec131c446d90a47 /container-search
parent3c6887a27a5acafbbcb8d2b42dbb0c02caf1308b (diff)
Make the criteria for taking a node down clear.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java55
1 files changed, 33 insertions, 22 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 85cc16ade6f..ffcdabcd07e 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
@@ -265,26 +265,18 @@ public class SearchCluster implements NodeManager<Node> {
}
}
- /**
- * Update statistics after a round of issuing pings.
- * Note that this doesn't wait for pings to return, so it will typically accumulate data from
- * last rounds pinging, or potentially (although unlikely) some combination of new and old data.
- */
- @Override
- public void pingIterationCompleted() {
+ private void pingIterationCompletedSingleGroup() {
+ Group group = groups.values().iterator().next();
+ group.aggregateActiveDocuments();
+ // With just one group sufficient coverage may not be the same as full coverage, as the
+ // group will always be marked sufficient for use.
+ updateSufficientCoverage(group, true);
+ boolean fullCoverage = isGroupCoverageSufficient(group.workingNodes(), group.nodes().size(), group.getActiveDocuments(),
+ group.getActiveDocuments());
+ trackGroupCoverageChanges(0, group, fullCoverage, group.getActiveDocuments());
+ }
+ private void pingIterationCompletedMultipleGroups() {
int numGroups = orderedGroups.size();
- if (numGroups == 1) {
- Group group = groups.values().iterator().next();
- group.aggregateActiveDocuments();
- // With just one group sufficient coverage may not be the same as full coverage, as the
- // group will always be marked sufficient for use.
- updateSufficientCoverage(group, true);
- boolean fullCoverage = isGroupCoverageSufficient(group.workingNodes(), group.nodes().size(), group.getActiveDocuments(),
- group.getActiveDocuments());
- trackGroupCoverageChanges(0, group, fullCoverage, group.getActiveDocuments());
- return;
- }
-
// Update active documents per group and use it to decide if the group should be active
long[] activeDocumentsInGroup = new long[numGroups];
@@ -306,9 +298,28 @@ public class SearchCluster implements NodeManager<Node> {
updateSufficientCoverage(group, sufficientCoverage);
trackGroupCoverageChanges(i, group, sufficientCoverage, averageDocumentsInOtherGroups);
}
- if ( ! anyGroupsSufficientCoverage && (sumOfActiveDocuments == 0)) {
- // If no groups have sufficient coverage (0 might be sufficient)
- // and there are no documents in any groups, then we are down.
+ }
+ private boolean areAllNodesDownInAllgroups() {
+ for(int i = 0; i < groups.size(); i++) {
+ Group group = orderedGroups.get(i);
+ if (group.workingNodes() == 0) return false;
+ }
+ return true;
+ }
+ /**
+ * Update statistics after a round of issuing pings.
+ * Note that this doesn't wait for pings to return, so it will typically accumulate data from
+ * last rounds pinging, or potentially (although unlikely) some combination of new and old data.
+ */
+ @Override
+ public void pingIterationCompleted() {
+ int numGroups = orderedGroups.size();
+ if (numGroups == 1) {
+ pingIterationCompletedSingleGroup();
+ } else {
+ pingIterationCompletedMultipleGroups();
+ }
+ if ( areAllNodesDownInAllgroups() ) {
vipStatus.removeFromRotation(clusterId);
}
}