psalagnac commented on code in PR #2737:
URL: https://github.com/apache/solr/pull/2737#discussion_r1827855744


##########
solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java:
##########
@@ -242,45 +240,15 @@ public static void waitForCollectionToDisappear(
     log.info("Collection has disappeared - collection:{}", collection);
   }
 
-  static void waitForNewLeader(
-      CloudSolrClient cloudClient, String shardName, Replica oldLeader, 
TimeOut timeOut)
+  static void waitForNewLeader(CloudSolrClient cloudClient, String shardName, 
Replica oldLeader)
       throws Exception {
-    log.info("Will wait for a node to become leader for {} secs", 
timeOut.timeLeft(SECONDS));
+    log.info("Will wait for a node to become leader for 15 secs");
     ZkStateReader zkStateReader = ZkStateReader.from(cloudClient);
-    zkStateReader.forceUpdateCollection(DEFAULT_COLLECTION);
-
-    for (; ; ) {
-      ClusterState clusterState = zkStateReader.getClusterState();
-      DocCollection coll = clusterState.getCollection("collection1");
-      Slice slice = coll.getSlice(shardName);
-      if (slice.getLeader() != null
-          && !slice.getLeader().equals(oldLeader)
-          && slice.getLeader().getState() == Replica.State.ACTIVE) {
-        if (log.isInfoEnabled()) {
-          log.info(
-              "Old leader {}, new leader {}. New leader got elected in {} ms",
-              oldLeader,
-              slice.getLeader(),
-              timeOut.timeElapsed(MILLISECONDS));
-        }
-        break;
-      }
-
-      if (timeOut.hasTimedOut()) {

Review Comment:
   Good point. But this is at the cost of potentially slower test execution 
since we don't unblock the test thread when we receive the ZK watch.
   
   We would get the same if we call `logThreadDumps(...)` and 
`printLayoutToStream(...)` in case of error. I can do such a change.



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