serhiy-bzhezytskyy commented on code in PR #4760:
URL: https://github.com/apache/solr/pull/4760#discussion_r3822314289
##########
solr/core/src/test/org/apache/solr/cloud/MoveReplicaTest.java:
##########
@@ -342,7 +342,10 @@ private CollectionAdminRequest.MoveReplica
createMoveReplicaRequest(
}
private Replica getRandomReplica(String coll, CloudSolrClient cloudClient)
throws IOException {
- List<Replica> replicas =
cloudClient.getClusterState().getCollection(coll).getReplicas();
+ List<Replica> replicas = new ArrayList<>();
+ for (Slice slice : cloudClient.getClusterState().getCollection(coll)) {
+ replicas.addAll(slice.getReplicas());
+ }
Collections.shuffle(replicas, random());
return replicas.get(0);
Review Comment:
Done -- and made it more elegant per your own "no wasted List accumulation"
point: `getReplicaStream().collect(Collectors.toCollection(ArrayList::new))`
builds the mutable list directly in one pass instead of `toList()` + a copying
`new ArrayList<>()`.
AI-assisted (Claude Sonnet 5)
##########
solr/core/src/test/org/apache/solr/cloud/NestedShardedAtomicUpdateTest.java:
##########
@@ -71,8 +72,10 @@ public static void beforeClass() throws Exception {
clients = new ArrayList<>();
ClusterState clusterState = cloudClient.getClusterState();
- for (Replica replica :
clusterState.getCollection(DEFAULT_COLLECTION).getReplicas()) {
- clients.add(getHttpSolrClient(replica));
+ for (Slice slice : clusterState.getCollection(DEFAULT_COLLECTION)) {
+ for (Replica replica : slice.getReplicas()) {
+ clients.add(getHttpSolrClient(replica));
+ }
Review Comment:
Done -- `getReplicaStream().forEach(...)`.
AI-assisted (Claude Sonnet 5)
--
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]