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


##########
solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java:
##########
@@ -1145,40 +1123,32 @@ protected String getRemoteCoreUrl(String 
collectionName, String origCorename)
           "No active replicas found for collection: " + collectionName);
     }
 
-    String coreUrl =
-        getCoreUrl(collectionName, origCorename, clusterState, activeSlices, 
byCoreName, true);
+    String coreUrl = getCoreUrl(origCorename, clusterState, activeSlices, 
byCoreName, true);
 
     if (coreUrl == null) {
-      coreUrl =
-          getCoreUrl(collectionName, origCorename, clusterState, activeSlices, 
byCoreName, false);
+      coreUrl = getCoreUrl(origCorename, clusterState, activeSlices, 
byCoreName, false);
     }
 
     return coreUrl;
   }
 
   private String getCoreUrl(
-      String collectionName,
       String origCorename,
       ClusterState clusterState,
-      List<Slice> slices,
+      Collection<Slice> slices,
       boolean byCoreName,
       boolean activeReplicas) {
     String coreUrl;
     Set<String> liveNodes = clusterState.getLiveNodes();
 
-    List<Slice> shuffledSlices;
-    if (slices.size() < 2) {
-      shuffledSlices = slices;
-    } else {
-      shuffledSlices = new ArrayList<>(slices);
-      Collections.shuffle(shuffledSlices, Utils.RANDOM);
-    }
+    Iterator<Slice> shuffledSlices = new RandomIterator<>(Utils.RANDOM, 
slices);

Review Comment:
   Thanks for looking closer.  I see there's some dead code to remove -- 
byCoreName and don't pass origCorename in either.  I'll do another update to 
clarify.



-- 
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