serhiy-bzhezytskyy commented on code in PR #4760:
URL: https://github.com/apache/solr/pull/4760#discussion_r3823133389
##########
solr/core/src/test/org/apache/solr/cloud/MoveReplicaTest.java:
##########
@@ -342,10 +343,12 @@ private CollectionAdminRequest.MoveReplica
createMoveReplicaRequest(
}
private Replica getRandomReplica(String coll, CloudSolrClient cloudClient)
throws IOException {
- List<Replica> replicas = new ArrayList<>();
- for (Slice slice : cloudClient.getClusterState().getCollection(coll)) {
- replicas.addAll(slice.getReplicas());
- }
+ List<Replica> replicas =
+ cloudClient
+ .getClusterState()
+ .getCollection(coll)
+ .getReplicaStream()
+ .collect(Collectors.toCollection(ArrayList::new));
Review Comment:
Done -- avoided the shuffle entirely, `.toList()` + a random index.
--
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]