Caideyipi commented on code in PR #18396:
URL: https://github.com/apache/iotdb/pull/18396#discussion_r3734811379


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java:
##########
@@ -868,6 +902,24 @@ private void consumeParsedTabletInsertionEventWithRetry(
     }
   }
 
+  private void sleepForParserRetry(
+      final long sleepTimeInMs, final PipeProcessorSubtaskExecutionGuard 
processorExecutionGuard)
+      throws InterruptedException {
+    if (!processorExecutionGuard.isEnabled()) {
+      Thread.sleep(sleepTimeInMs);
+      return;
+    }
+
+    final long deadlineInMs = System.currentTimeMillis() + sleepTimeInMs;
+    long remainingTimeInMs = sleepTimeInMs;
+    while (remainingTimeInMs > 0) {
+      processorExecutionGuard.check();
+      Thread.sleep(Math.min(remainingTimeInMs, 100));
+      processorExecutionGuard.check();
+      remainingTimeInMs = deadlineInMs - System.currentTimeMillis();
+    }

Review Comment:
   The guard currently has no registered-thread facility; its 100 ms polling 
interval bounds stop latency while keeping the guard usable across the existing 
worker and parser call paths. Registering and interrupting sleeping threads 
would require a broader guard lifecycle change, so I am leaving that as a 
separate optimization.



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

Reply via email to