diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-11 19:18:20 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-01-11 19:18:20 +0000 |
commit | a30172716faa0a2f2ee6d300755158613e19f7c8 (patch) | |
tree | ff695141248d6115faf9644f2bdecc1b19de2adc /container-search | |
parent | 9043ed4ac5f1c8a4af91b1e2b2ff602bc1963c27 (diff) |
You must use one of the candidates in the set you got.
It is not legal to change the set of candidates and perform a re-election if you are unhappy.
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/SearchPath.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/SearchPath.java b/container-search/src/main/java/com/yahoo/search/dispatch/SearchPath.java index f87fc20e96e..7937be50813 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/SearchPath.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/SearchPath.java @@ -105,7 +105,7 @@ public class SearchPath { } private Group selectRandomGroupWithSufficientCoverage(SearchCluster cluster, List<Integer> groupIds) { - while ( ! groupIds.isEmpty()) { + while ( groupIds.size() > 1 ) { int index = random.nextInt(groupIds.size()); int groupId = groupIds.get(index); Optional<Group> group = cluster.group(groupId); @@ -119,7 +119,7 @@ public class SearchPath { throw new InvalidSearchPathException("Invalid searchPath, cluster does not have " + (groupId + 1) + " groups"); } } - return cluster.groups().values().iterator().next(); + return cluster.group(groupIds.get(0)).get(); } private Group selectGroup(SearchCluster cluster) { |