summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-08-30 09:24:21 +0200
committerJon Bratseth <bratseth@oath.com>2018-08-30 09:24:21 +0200
commitd76ddd314188f39cc8e4fb8ffde464a456e48974 (patch)
tree76a89fcc7393b9bf3cc28e24d1f3763ec9c2a303 /container-search
parent8d32f55ec5fb5066108356bba7d6565cfd9b547c (diff)
Revert to previous VIP status management from dispatch
The new behavior does not work in the (unrealistic, but used in tests) case where there are multiple local one-node content clusters.
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java8
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTester.java6
2 files changed, 9 insertions, 5 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java b/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java
index a4d7a54a80e..efce2fdac9c 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java
@@ -182,7 +182,7 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
node.setWorking(true);
if (usesDirectDispatchTo(node))
- vipStatus.setInRotation(true);
+ vipStatus.addToRotation(this);
}
/** Used by the cluster monitor to manage node status */
@@ -192,16 +192,16 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
// Take ourselves out if we usually dispatch only to our own host
if (usesDirectDispatchTo(node))
- vipStatus.setInRotation(false);
+ vipStatus.removeFromRotation(this);
}
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.setInRotation(true);
+ vipStatus.addToRotation(this);
} else {
- vipStatus.setInRotation(false);
+ vipStatus.removeFromRotation(this);
}
}
group.setHasSufficientCoverage(sufficientCoverage);
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTester.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTester.java
index c70e1138954..4f99f06986a 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTester.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTester.java
@@ -2,6 +2,7 @@
package com.yahoo.prelude.fastsearch.test;
import com.google.common.util.concurrent.MoreExecutors;
+import com.yahoo.container.handler.ClustersStatus;
import com.yahoo.container.handler.VipStatus;
import com.yahoo.net.HostName;
import com.yahoo.prelude.fastsearch.CacheParams;
@@ -35,7 +36,7 @@ class FastSearcherTester {
private final MockFS4ResourcePool mockFS4ResourcePool;
private final FastSearcher fastSearcher;
private final MockDispatcher mockDispatcher;
- private final VipStatus vipStatus = new VipStatus();
+ private final VipStatus vipStatus;
public FastSearcherTester(int containerClusterSize, SearchCluster.Node searchNode) {
this(containerClusterSize, Collections.singletonList(searchNode));
@@ -46,6 +47,9 @@ class FastSearcherTester {
}
public FastSearcherTester(int containerClusterSize, List<SearchCluster.Node> searchNodes) {
+ ClustersStatus clustersStatus = new ClustersStatus();
+ clustersStatus.setContainerHasClusters(true);
+ vipStatus = new VipStatus(clustersStatus);
mockFS4ResourcePool = new MockFS4ResourcePool();
mockDispatcher = new MockDispatcher(searchNodes, mockFS4ResourcePool, containerClusterSize, vipStatus);
fastSearcher = new FastSearcher(new MockBackend(Optional.empty(), selfHostname, 0L, true),