serhiy-bzhezytskyy commented on code in PR #4760:
URL: https://github.com/apache/solr/pull/4760#discussion_r3821162799


##########
solr/core/src/java/org/apache/solr/cloud/api/collections/ReindexCollectionCmd.java:
##########
@@ -714,9 +715,11 @@ private Replica getReplicaForDaemon(SolrResponse rsp, 
DocCollection coll) {
       return null;
     }
     // build a baseUrl of the replica
-    for (Replica r : coll.getReplicas()) {
-      if (replicaName.equals(r.getCoreName())) {
-        return r;
+    for (Slice slice : coll) {

Review Comment:
   `coll` is a `DocCollection`, which is `Iterable<Slice>` -- a collection has 
one or more shards, so the outer loop runs once per shard, not once total. This 
is a direct unroll of what the old `getReplicas()` did internally (`for (Slice 
slice : this) { replicas.addAll(slice.getReplicas()); }`), just inlined instead 
of calling the now-removed method.
   
   AI-assisted (Claude Sonnet 5)



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionTooManyReplicasTest.java:
##########
@@ -113,8 +113,10 @@ public void testAddTooManyReplicas() throws Exception {
         "Expected to see all replicas active",
         collectionName,
         c -> {
-          for (Replica r : c.getReplicas()) {
-            if (r.getState() != Replica.State.ACTIVE) return false;
+          for (Slice s : c) {

Review Comment:
   Same as the `ReindexCollectionCmd.java:718` thread -- `c` iterates its 
shards, one loop per shard.
   
   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]

Reply via email to