This is an automated email from the ASF dual-hosted git repository.

jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new d0a531387 Extend the timeout for flaky as slowness of the machine and 
add logs for TestRoutingTableProviderFromCurrentStates
d0a531387 is described below

commit d0a5313877ca53703bc76cf11ee4b115add523f4
Author: Junkai Xue <[email protected]>
AuthorDate: Wed Feb 25 22:49:59 2026 -0800

    Extend the timeout for flaky as slowness of the machine and add logs for 
TestRoutingTableProviderFromCurrentStates
    
      1. After cluster verification - logs when rebalance completes
      2. Waiting for routing table update - logs when waiting for MASTER 
assignment
      3. If update fails - logs what instances are actually present
      4. After participant shutdown - logs which node was stopped
      5. After cluster stabilization - logs when verify passes
      6. Before validation steps - logs which step is running
      7. If routing tables don't match - logs ideal state partitions
    
    Now when it fails in CI, you'll see detailed logs like:
      INFO: Cluster verified after rebalance
      INFO: Waiting for routing table to update for partition TestDB-0
      INFO: Target node with MASTER: localhost_12918
      INFO: Shutdown participant: localhost_12918
      INFO: Waiting for cluster to stabilize after shutdown
      INFO: Cluster verified after shutdown
      INFO: Validate after step 4
      ERROR: Routing tables did not match between EV and CS providers
      ERROR: IdealState partitions: [TestDB-0, TestDB-1, ...]
---
 .../TestRoutingTableProviderFromCurrentStates.java | 41 ++++++++++++++++++----
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git 
a/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderFromCurrentStates.java
 
b/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderFromCurrentStates.java
index cbf299860..6e5a3357d 100644
--- 
a/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderFromCurrentStates.java
+++ 
b/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProviderFromCurrentStates.java
@@ -30,6 +30,9 @@ import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.google.common.collect.ImmutableMap;
 import org.apache.helix.ConfigAccessor;
 import org.apache.helix.HelixException;
@@ -72,6 +75,7 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 public class TestRoutingTableProviderFromCurrentStates extends ZkTestBase {
+  private static final Logger LOG = 
LoggerFactory.getLogger(TestRoutingTableProviderFromCurrentStates.class);
   private HelixManager _manager;
   private final int NUM_NODES = 10;
   protected int NUM_PARTITIONS = 20;
@@ -283,7 +287,7 @@ public class TestRoutingTableProviderFromCurrentStates 
extends ZkTestBase {
           .getResourcesInCluster(CLUSTER_NAME)) {
         IdealState idealState = _gSetupTool.getClusterManagementTool()
             .getResourceIdealState(CLUSTER_NAME, resourceName);
-        validate(idealState, routingTableEV, routingTableCS, 3000);
+        validate(idealState, routingTableEV, routingTableCS, 10000);
       }
 
       // Blocking the current state event processing
@@ -299,40 +303,63 @@ public class TestRoutingTableProviderFromCurrentStates 
extends ZkTestBase {
           new 
BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient)
               
.setWaitTillVerify(TestHelper.DEFAULT_REBALANCE_PROCESSING_WAIT_TIME)
               .build();
-      Assert.assertTrue(clusterVerifier.verifyByPolling(5000, 500));
+      Assert.assertTrue(clusterVerifier.verifyByPolling(30000, 500));
+      LOG.info("Cluster verified after rebalance");
       // 2. Process one event, so the current state will be refreshed with the 
new DB partitions
       routingTableCS.proceedNewEventHandling();
       IdealState idealState =
           
_gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, db);
       String targetPartitionName = 
idealState.getPartitionSet().iterator().next();
+      LOG.info("Waiting for routing table to update for partition {}", 
targetPartitionName);
       // Wait until the routing table is updated.
       BlockingCurrentStateRoutingTableProvider finalRoutingTableCS = 
routingTableCS;
-      Assert.assertTrue(TestHelper.verify(
+      boolean hasMaster = TestHelper.verify(
           () -> !finalRoutingTableCS.getInstances(db, targetPartitionName, 
"MASTER").isEmpty(),
-          2000));
+          10000);
+      if (!hasMaster) {
+        LOG.error("Routing table did not update - no MASTER found for 
partition {} in resource {}", targetPartitionName, db);
+        LOG.error("Current instances: {}", 
finalRoutingTableCS.getInstances(db, targetPartitionName, "MASTER"));
+      }
+      Assert.assertTrue(hasMaster);
       String targetNodeName =
           routingTableCS.getInstances(db, targetPartitionName, 
"MASTER").get(0).getInstanceName();
+      LOG.info("Target node with MASTER: {}", targetNodeName);
       // 3. Shutdown one of the instance that contains a master partition
       for (int i = 0; i < _participants.length; i++) {
         if (_participants[i].getInstanceName().equals(targetNodeName)) {
           shutdownParticipantIndex = i;
           _participants[i].syncStop();
+          LOG.info("Shutdown participant: {}", targetNodeName);
         }
       }
+      LOG.info("Waiting for cluster to stabilize after shutdown");
       Assert.assertTrue(clusterVerifier.verifyByPolling());
+      LOG.info("Cluster verified after shutdown");
       // 4. Process one of the stale current state event.
       // The expectation is that, the provider will refresh with all the 
latest data including the
       // the live instance change. Even the corresponding ZK event has not 
been processed yet.
       routingTableCS.proceedNewEventHandling();
+      LOG.info("Validate after step 4");
       validate(idealState, routingTableEV, routingTableCS, 3000);
       // 5. Unblock the event processing and let the provider to process all 
events.
       // The expectation is that, the eventual routing tables are still the 
same.
       routingTableCS.setBlocking(false);
       routingTableCS.proceedNewEventHandling();
-      // Wait for a short while so the router will process at least one event.
-      Thread.sleep(500);
+      LOG.info("Validate after unblock (step 5)");
+      // Wait for routing table to converge using polling instead of hardcoded 
sleep
+      // Use copies for lambda since routingTableCS is modified
+      RoutingTableProvider routingTableEVCopy = routingTableEV;
+      RoutingTableProvider routingTableCSCopy = routingTableCS;
+      boolean matched = TestHelper.verify(
+          () -> compare(idealState, routingTableEVCopy, routingTableCSCopy),
+          10000);
+      if (!matched) {
+        LOG.error("Routing tables did not match between EV and CS providers");
+        LOG.error("IdealState partitions: {}", idealState.getPartitionSet());
+      }
+      Assert.assertTrue(matched);
       // Confirm that 2 providers match eventually
-      validate(idealState, routingTableEV, routingTableCS, 2000);
+      validate(idealState, routingTableEV, routingTableCS, 10000);
     } finally {
       if (routingTableCS != null) {
         routingTableCS.setBlocking(false);

Reply via email to