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

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


The following commit(s) were added to refs/heads/master by this push:
     new be8606615e5 Fix SinkChannel failure propagation test race (#18675)
be8606615e5 is described below

commit be8606615e510910ad026d5bdf0327ebe550e6c5
Author: Caideyipi <[email protected]>
AuthorDate: Tue Sep 22 15:31:48 2026 +0800

    Fix SinkChannel failure propagation test race (#18675)
---
 .../exchange/SinkChannelFailurePropagationTest.java          | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/exchange/SinkChannelFailurePropagationTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/exchange/SinkChannelFailurePropagationTest.java
index 9564b104766..7030b5c210c 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/exchange/SinkChannelFailurePropagationTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/exchange/SinkChannelFailurePropagationTest.java
@@ -308,20 +308,21 @@ public class SinkChannelFailurePropagationTest {
       stateTracker.start();
 
       Assert.assertTrue(sinkHandle.isFull().isDone());
-      long failureStartNanos = System.nanoTime();
       sinkHandle.send(Utils.createMockTsBlocks(1, 1024).get(0));
 
       Mockito.verify(exchangeClient, 
Mockito.timeout(5_000).times(SinkChannel.MAX_ATTEMPT_TIMES))
           .onNewDataBlockEvent(Mockito.any(TNewDataBlockEvent.class));
+      long waitStartNanos = System.nanoTime();
       while (!fragmentStateMachine.getState().isDone()
-          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - 
failureStartNanos) < 5) {
+          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - 
waitStartNanos) < 5) {
         Thread.sleep(10);
       }
 
       Assert.assertEquals(FragmentInstanceState.FAILED, 
fragmentStateMachine.getState());
       Assert.assertEquals(expectedFailure, 
fragmentStateMachine.getFailureCauses().peek());
-      while (!sinkChannel.isAborted()
-          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - 
failureStartNanos) < 5) {
+      waitStartNanos = System.nanoTime();
+      while (!sinkHandle.isAborted()
+          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - 
waitStartNanos) < 5) {
         Thread.sleep(10);
       }
       Assert.assertTrue(sinkHandle.isAborted());
@@ -330,8 +331,9 @@ public class SinkChannelFailurePropagationTest {
       Assert.assertFalse(sinkChannel.isClosed());
       Assert.assertEquals(0, exchangeManager.getShuffleSinkHandleSize());
 
+      waitStartNanos = System.nanoTime();
       while (!queryStateMachine.getState().isDone()
-          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - 
failureStartNanos) < 5) {
+          && TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - 
waitStartNanos) < 5) {
         Thread.sleep(10);
       }
       Mockito.verify(stateClient, Mockito.timeout(3_000).atLeastOnce())

Reply via email to