aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-01-11 20:59:43 +0100
committerGitHub <noreply@github.com>2021-01-11 20:59:43 +0100
commit6d5b7bb9cff88d5030a606082b703a2c706e0747 (patch)
treeff695141248d6115faf9644f2bdecc1b19de2adc
parent9043ed4ac5f1c8a4af91b1e2b2ff602bc1963c27 (diff)
parenta30172716faa0a2f2ee6d300755158613e19f7c8 (diff)
Merge pull request #15999 from vespa-engine/balder/only-consider-prequalified-candidates
You must use one of the candidates in the set you got.
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/SearchPath.java4
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) {