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/06/06 09:26:21 UTC

[incubator-iotdb] branch feature_async_close_tsfile updated: add logs to print the time of enqueuing flush queue and the queue length

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

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


The following commit(s) were added to refs/heads/feature_async_close_tsfile by this push:
     new e2a2ae8  add logs to print the time of enqueuing flush queue and the queue length
e2a2ae8 is described below

commit e2a2ae87fe5a588f6771201ff22fb1f55ee8d854
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Thu Jun 6 17:26:10 2019 +0800

    add logs to print the time of enqueuing flush queue and the queue length
---
 .../apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java | 9 ++++++++-
 .../main/java/org/apache/iotdb/db/engine/pool/FlushManager.java  | 8 ++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

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 61a9f39..19e4d4c 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
@@ -356,7 +356,8 @@ public class BufferWriteProcessor extends Processor {
       if (LOGGER.isInfoEnabled()) {
         long thisFlushTime = System.currentTimeMillis();
         LOGGER.info(
-            "The bufferwrite processor {}: last flush time is {}, this flush time is {}, "
+            "The bufferwrite processor {} will submit a flush task."
+                + "The last flush time is {}, this flush time is {}, "
                 + "flush time interval is {}s", getProcessorName(),
             DatetimeUtils.convertMillsecondToZonedDateTime(lastFlushTime),
             DatetimeUtils.convertMillsecondToZonedDateTime(thisFlushTime),
@@ -396,6 +397,12 @@ public class BufferWriteProcessor extends Processor {
       BasicMemController.getInstance().releaseUsage(this, memSize.get());
       memSize.set(0);
       // switch
+      if (LOGGER.isInfoEnabled()) {
+        LOGGER.info(
+            "Begin to submit flush task for bufferwrite processor {}, current Flush Queue is {}, core pool size is {}.",
+            getProcessorName(), FlushManager.getInstance().getWaitingTasksNumber(),
+            FlushManager.getInstance().getCorePoolSize());
+      }
       flushFuture = FlushManager.getInstance().submit(() -> flushTask("asynchronously",
           version, walTaskId));
     } else {
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/pool/FlushManager.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/pool/FlushManager.java
index 86feaf0..1028014 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/pool/FlushManager.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/pool/FlushManager.java
@@ -136,4 +136,12 @@ public class FlushManager {
     }
     private static FlushManager instance = new FlushManager();
   }
+
+  public int getWaitingTasksNumber() {
+    return ((ThreadPoolExecutor) pool).getQueue().size();
+  }
+
+  public int getCorePoolSize() {
+    return ((ThreadPoolExecutor) pool).getCorePoolSize();
+  }
 }