diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-11-25 11:49:07 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-11-25 11:49:07 +0100 |
commit | 74888eb3f0d5626575f7008cf357ddeaa746b9a6 (patch) | |
tree | 2081558aeb73b856af77b055c4593c25ed0a2986 /container-search/src/main/java/com/yahoo/search/dispatch/searchcluster | |
parent | c671a36ae0cd655c2efc38ee9882baa8354d660b (diff) |
Cleanup and throw IllegalArgumentException on invalid path
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/searchcluster')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/Node.java | 6 | ||||
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchGroupsImpl.java | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/Node.java b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/Node.java index d9c0198a472..73a3c3742cc 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/Node.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/Node.java @@ -55,7 +55,11 @@ public class Node { public String hostname() { return hostname; } - /** Returns the id of the group this node belongs to */ + /** + * Returns the index of the group this node belongs to. + * This is a 0-base continuous integer id, not necessarily the same as the group id assigned by the + * application/node repo. + */ public int group() { return group; } public void setWorking(boolean working) { diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchGroupsImpl.java b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchGroupsImpl.java index f5ce987c64c..906268c5904 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchGroupsImpl.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchGroupsImpl.java @@ -8,16 +8,20 @@ import java.util.Set; import java.util.stream.Collectors; public class SearchGroupsImpl implements SearchGroups { + private final Map<Integer, Group> groups; private final double minActivedocsPercentage; + public SearchGroupsImpl(Map<Integer, Group> groups, double minActivedocsPercentage) { this.groups = Map.copyOf(groups); this.minActivedocsPercentage = minActivedocsPercentage; } + @Override public Group get(int id) { return groups.get(id); } @Override public Set<Integer> keys() { return groups.keySet();} @Override public Collection<Group> groups() { return groups.values(); } @Override public int size() { return groups.size(); } + @Override public boolean isPartialGroupCoverageSufficient(Collection<Node> nodes) { if (size() == 1) |