You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by jx...@apache.org on 2026/04/09 05:21:38 UTC

(helix) branch master updated: Stablize TestHelixTaskExecutor

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 d0aaa0c61 Stablize TestHelixTaskExecutor
d0aaa0c61 is described below

commit d0aaa0c61652dc4d05cd469bcaaa5738cd6c48eb
Author: Junkai Xue <jx...@apache.org>
AuthorDate: Wed Apr 8 22:17:37 2026 -0700

    Stablize TestHelixTaskExecutor
    
      1. Increased initial sleep from 1000ms to 2000ms to give the executor more time to start processing
      2. Added minPollsBeforeAcceptingStability = 3 to ensure we poll at least 3 times before accepting stability
      3. Added pollCount tracking to enforce the minimum poll requirement
---
 .../apache/helix/messaging/handling/TestHelixTaskExecutor.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
index 959565d89..48e986225 100644
--- a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
+++ b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java
@@ -990,7 +990,7 @@ public class TestHelixTaskExecutor {
     LOG.info("Submitted {} messages to executor", msgList.size());
 
     // Give executor time to receive and queue messages before starting to poll
-    Thread.sleep(1000);
+    Thread.sleep(2000);
 
     // Wait for processing to stabilize - poll until counts stop changing
     // Increased maxWaitTime to 30 seconds for flaky test stability
@@ -999,6 +999,8 @@ public class TestHelixTaskExecutor {
     int stableCount = 0;
     int lastCancelCount = -1;
     int lastStateTransitionCount = -1;
+    int minPollsBeforeAcceptingStability = 3; // Ensure we poll at least 3 times before accepting stability
+    int pollCount = 0;
 
     LOG.info("Waiting up to {} ms for processing to stabilize...", maxWaitTime);
     long startTime = System.currentTimeMillis();
@@ -1006,10 +1008,13 @@ public class TestHelixTaskExecutor {
     while (System.currentTimeMillis() - startTime < maxWaitTime) {
       int currentCancelCount = cancelFactory._processedMsgIds.size();
       int currentStateTransitionCount = stateTransitionFactory._processedMsgIds.size();
+      pollCount++;
 
       if (currentCancelCount == lastCancelCount && currentStateTransitionCount == lastStateTransitionCount) {
         stableCount++;
-        if (stableCount >= 2) {
+        // Only accept early stability after at least minPollsBeforeAcceptingStability polls
+        // to ensure processing has had a chance to start
+        if (stableCount >= 2 && pollCount >= minPollsBeforeAcceptingStability) {
           LOG.info("Processing stabilized after {} ms", System.currentTimeMillis() - startTime);
           break;
         }