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/04/12 12:19:31 UTC

[incubator-iotdb] branch master updated: fix the future instance is replaced when the flush frequency is high (#145)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 38147ac  fix the future instance is replaced when the flush frequency is high (#145)
38147ac is described below

commit 38147ac95844359181c51399c31869cc2683bbca
Author: Xiangdong Huang <hx...@qq.com>
AuthorDate: Fri Apr 12 20:19:27 2019 +0800

    fix the future instance is replaced when the flush frequency is high (#145)
    
    * fix the future instance is replaced when the flush frequency is high
    
    * throw exception when flushing failed
    
    * throw exception when flushing failed
---
 .../db/engine/bufferwrite/BufferWriteProcessor.java      | 15 ++++++---------
 .../iotdb/db/engine/overflow/io/OverflowProcessor.java   | 16 ++++++----------
 2 files changed, 12 insertions(+), 19 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 e09feec..5f61fa4 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
@@ -332,16 +332,13 @@ public class BufferWriteProcessor extends Processor {
     }
     lastFlushTime = System.nanoTime();
     // check value count
+    // waiting for the end of last flush operation.
+    try {
+      flushFuture.get();
+    } catch (InterruptedException | ExecutionException e) {
+      throw new IOException(e);
+    }
     if (valueCount > 0) {
-      // waiting for the end of last flush operation.
-      try {
-        flushFuture.get();
-      } catch (InterruptedException | ExecutionException e) {
-        LOGGER.error("Encounter an interrupt error when waitting for the flushing, "
-                + "the bufferwrite processor is {}.",
-            getProcessorName(), e);
-        Thread.currentThread().interrupt();
-      }
       // update the lastUpdatetime, prepare for flush
       try {
         bufferwriteFlushAction.act();
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 0debfe4..f98bff2 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
@@ -475,7 +475,7 @@ public class OverflowProcessor extends Processor {
   @Override
   public synchronized Future<Boolean> flush() throws IOException {
     // statistic information for flush
-    if (lastFlushTime > 0) {
+    if (lastFlushTime > 0 && LOGGER.isInfoEnabled()) {
       long thisFLushTime = System.currentTimeMillis();
       ZonedDateTime lastDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(lastFlushTime),
           IoTDBDescriptor.getInstance().getConfig().getZoneID());
@@ -488,17 +488,13 @@ public class OverflowProcessor extends Processor {
           (thisFLushTime - lastFlushTime) / 1000);
     }
     lastFlushTime = System.currentTimeMillis();
-    // value count
+    try {
+      flushFuture.get();
+    } catch (InterruptedException | ExecutionException e) {
+      throw new IOException(e);
+    }
     if (valueCount > 0) {
       try {
-        flushFuture.get();
-      } catch (InterruptedException | ExecutionException e) {
-        LOGGER.error("Encounter an interrupt error when waitting for the flushing, "
-                + "the bufferwrite processor is {}.",
-            getProcessorName(), e);
-        Thread.currentThread().interrupt();
-      }
-      try {
         // backup newIntervalFile list and emptyIntervalFileNode
         overflowFlushAction.act();
       } catch (Exception e) {