You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/02/21 05:51:27 UTC

[incubator-iotdb] branch fix_add_future_4_flush_opeartion updated: using flushMemTable!=null to determine whehter a flushTask is running rather than using future.isDone()

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

hxd pushed a commit to branch fix_add_future_4_flush_opeartion
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/fix_add_future_4_flush_opeartion by this push:
     new 03e91a3  using flushMemTable!=null to determine whehter a flushTask is running rather than using future.isDone()
03e91a3 is described below

commit 03e91a38498b065763b9e31ab669654ebe20de55
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Thu Feb 21 13:51:12 2019 +0800

    using flushMemTable!=null to determine whehter a flushTask is running rather than using future.isDone()
---
 .../apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java  | 8 +++++++-
 .../org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java | 3 ++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java
index 6b45597..e2cf818 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java
@@ -411,7 +411,13 @@ public class BufferWriteProcessor extends Processor {
    * @return True if flushing
    */
   public boolean isFlush() {
-    return !flushFuture.isDone();
+    // starting a flush task has two steps: set the flushMemtable, and then set the flushFuture
+    // So, the following case exists: flushMemtable != null but flushFuture is done (because the
+    // flushFuture refers to the last finished flush.
+    // And, the following case exists,too: flushMemtable == null, but flushFuture is not done.
+    // (flushTask() is not finished, but switchToWork() has done)
+    // So, checking flushMemTable is more meaningful than flushFuture.isDone().
+    return  flushMemTable != null;
   }
 
   /**
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java
index f6e857f..331fa33 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/overflow/io/OverflowProcessor.java
@@ -420,7 +420,8 @@ public class OverflowProcessor extends Processor {
   }
 
   public boolean isFlush() {
-    return !flushFuture.isDone();
+    //see BufferWriteProcess.isFlush()
+    return  flushSupport != null;
   }
 
   private boolean flushTask(String displayMessage) {