You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/04/25 08:57:21 UTC

[iotdb] branch xingtanzjr/fix_finish_issue created (now c05a6cc536)

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

xingtanzjr pushed a change to branch xingtanzjr/fix_finish_issue
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at c05a6cc536 fix the issue that FragmentInstance's status cannot be updated to FINISHED in some scenario

This branch includes the following new commits:

     new c05a6cc536 fix the issue that FragmentInstance's status cannot be updated to FINISHED in some scenario

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: fix the issue that FragmentInstance's status cannot be updated to FINISHED in some scenario

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c05a6cc536061ddf944dc4af913bda0209f07b2c
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Mon Apr 25 16:57:08 2022 +0800

    fix the issue that FragmentInstance's status cannot be updated to FINISHED in some scenario
---
 .../main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java  | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java
index c540103126..3c582efb07 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/buffer/SinkHandle.java
@@ -202,7 +202,8 @@ public class SinkHandle implements ISinkHandle {
     }
     synchronized (this) {
       closed = true;
-      noMoreTsBlocks = true;
+      // synchronized is reentrant lock, wo we can invoke setNoMoreTsBlocks() here.
+      setNoMoreTsBlocks();
     }
     sinkHandleListener.onClosed(this);
     logger.info("Sink handle {} is closed.", this);
@@ -231,6 +232,14 @@ public class SinkHandle implements ISinkHandle {
   @Override
   public synchronized void setNoMoreTsBlocks() {
     noMoreTsBlocks = true;
+    // In current implementation, the onFinish() is only invoked when receiving the
+    // acknowledge event from SourceHandle. If the acknowledge event happens before
+    // the close(), the onFinish() won't be invoked and the instance's status will
+    // always be FLUSHING. We cannot ensure the sequence of `acknowledge event` and
+    // `close` so we need to do following check every time `noMoreTsBlocks` is updated.
+    if (isFinished()) {
+      sinkHandleListener.onFinish(this);
+    }
   }
 
   @Override