You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "zhangyue19921010 (via GitHub)" <gi...@apache.org> on 2023/02/21 02:34:46 UTC

[GitHub] [hudi] zhangyue19921010 commented on a diff in pull request #8000: [HUDI-5792] fix CI test:TestDisruptorExecutionInSpark timeout problem

zhangyue19921010 commented on code in PR #8000:
URL: https://github.com/apache/hudi/pull/8000#discussion_r1112475380


##########
hudi-common/src/main/java/org/apache/hudi/common/util/queue/DisruptorMessageQueue.java:
##########
@@ -100,6 +104,17 @@ public void seal() {}
   public void close() {
     synchronized (this) {
       if (!isShutdown) {
+        if (Thread.currentThread().isInterrupted()) {

Review Comment:
   We need to set 
   ```
           isShutdown = true;
            isStarted = false;
   ```
   no matter current thread is interrupted or not



##########
hudi-common/src/main/java/org/apache/hudi/common/util/queue/DisruptorMessageQueue.java:
##########
@@ -100,6 +104,17 @@ public void seal() {}
   public void close() {
     synchronized (this) {
       if (!isShutdown) {
+        if (Thread.currentThread().isInterrupted()) {
+          // if current thread has been interrupted, we still give executor a chance to proceeding.
+          LOG.error("Disruptor Queue has been interrupted! Shutdown now.");
+          try {
+            queue.shutdown(TIMEOUT_WAITING_SECS, TimeUnit.SECONDS);
+          } catch (TimeoutException e) {
+            LOG.error("Disruptor Queue has been interrupted: " + e);
+            throw new HoodieException(e);
+          }
+          throw new HoodieException("Disruptor Queue has been interrupted! Shutdown now.");
+        }
         isShutdown = true;
         isStarted = false;
         queue.shutdown();

Review Comment:
   put this code in `else` block



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org