dsmiley commented on code in PR #3515:
URL: https://github.com/apache/solr/pull/3515#discussion_r2302023240


##########
solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java:
##########
@@ -368,12 +368,6 @@ public List<Replica> getReplicasOnNode(String nodeName) {
     return nodeNameReplicas.get(nodeName);
   }
 
-  /** Get the list of all leaders hosted on the given node or 
<code>null</code> if none. */
-  @Deprecated
-  public List<Replica> getLeaderReplicas(String nodeName) {
-    return nodeNameLeaderReplicas.get(nodeName);

Review Comment:
   good but this PR should also remove `nodeNameLeaderReplicas`



##########
solr/core/src/test/org/apache/solr/update/processor/RoutedAliasUpdateProcessorTest.java:
##########
@@ -205,8 +205,11 @@ Set<String> getLeaderCoreNames(ClusterState clusterState) {
         String nodeName = jettySolrRunner.getNodeName();
         String collectionName = core.getCollectionName();
         DocCollection collectionOrNull = 
clusterState.getCollectionOrNull(collectionName);
-        List<Replica> leaderReplicas = 
collectionOrNull.getLeaderReplicas(nodeName);
-        if (leaderReplicas != null) {
+        if (collectionOrNull != null) {
+          List<Replica> replicas = 
collectionOrNull.getReplicasOnNode(nodeName);
+          assertNotNull(replicas);
+          List<Replica> leaderReplicas =
+              replicas.stream().filter(replica -> 
replica.isLeader()).collect(Collectors.toList());

Review Comment:
   You can use a method reference `Replica::isLeader`.  Also we can use 
`Stream.toList()` as we are on Java 17+.  Both these things make streams usage 
more succinct.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to