-
Notifications
You must be signed in to change notification settings - Fork 861
SOLR-18381: remove ClusterState.getReplicaNamesPerCollectionOnNode #4768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
fac3dd4
f2147ca
4fa2816
0916306
c5aa3a1
ab817a3
b79e94f
45531ad
a358173
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ | |
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Map.Entry; | ||
| import java.util.Objects; | ||
|
|
@@ -167,22 +166,6 @@ public Set<String> getLiveNodes() { | |
| return liveNodes; | ||
| } | ||
|
|
||
| @Deprecated | ||
| public Map<String, List<Replica>> getReplicaNamesPerCollectionOnNode(final String nodeName) { | ||
| Map<String, List<Replica>> replicaNamesPerCollectionOnNode = new HashMap<>(); | ||
| collectionStates.values().stream() | ||
| .map(CollectionRef::get) | ||
| .filter(Objects::nonNull) | ||
| .forEach( | ||
| col -> { | ||
| List<Replica> replicas = col.getReplicasOnNode(nodeName); | ||
| if (!replicas.isEmpty()) { | ||
| replicaNamesPerCollectionOnNode.put(col.getName(), replicas); | ||
| } | ||
| }); | ||
| return replicaNamesPerCollectionOnNode; | ||
| } | ||
|
|
||
| /** Check if node is alive. */ | ||
| public boolean liveNodesContain(String name) { | ||
| return liveNodes.contains(name); | ||
|
|
@@ -225,7 +208,7 @@ public static ClusterState createFromJson( | |
| return createFromCollectionMap(version, stateMap, liveNodes, creationTime, prsSupplier); | ||
| } | ||
|
|
||
| @Deprecated | ||
| /** Still used by {@link #createFromJson}. */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. createFromJson has been removed. We can remove this one. Ideally should have folded both together into the same change to tackle ClusterState API IMO.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checked — it has its own independent callers ( |
||
| public static ClusterState createFromCollectionMap( | ||
| int version, | ||
| Map<String, Object> stateMap, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at this, it's apparent the logic should be simplified to only get the list of replicas on this node for the collection the test cares about. No need for a Map; only a List. Could build in a single Stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already resolved --
mainpicked this up via #4760 (unrelated SOLR-18382 cleanup), and I just mergedmaininto this branch. Current code is exactly what you described: no Map, justclusterState.getCollection(collectionName).getReplicasOnNode(nodeName).