You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2019/06/12 09:20:16 UTC

[incubator-iotdb] branch feature_async_close_tsfile updated: fix close and value count is 0 does not release workmemtable bug

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

qiaojialin 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 0330154  fix close and value count  is 0  does not release workmemtable bug
0330154 is described below

commit 033015451000af65c5f6a7ec4e5f58738090dc59
Author: qiaojialin <64...@qq.com>
AuthorDate: Wed Jun 12 17:19:58 2019 +0800

    fix close and value count  is 0  does not release workmemtable bug
---
 .../org/apache/iotdb/db/engine/bufferwrite/BufferWriteProcessor.java  | 3 +++
 .../java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java     | 4 ++++
 2 files changed, 7 insertions(+)

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 6557efc..02ad6f5 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
@@ -436,6 +436,9 @@ public class BufferWriteProcessor extends Processor {
         workMemTable = MemTablePool.getInstance().getEmptyMemTable(this);
       }
     } else {
+      if (isCloseTaskCalled) {
+        MemTablePool.getInstance().release(workMemTable);
+      }
       flushFuture = new ImmediateFuture<>(true);
     }
     return flushFuture;
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
index a6ec145..1e6746b 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/engine/filenode/FileNodeManager.java
@@ -509,6 +509,8 @@ public class FileNodeManager implements IStatistic, IService {
     }
     try {
       long start2_3 = System.currentTimeMillis();
+
+      // write tsrecord and check flush
       if (!bufferWriteProcessor.write(tsRecord)) {
         start2_3 = System.currentTimeMillis() - start2_3;
         if (start2_3 > 1000) {
@@ -536,6 +538,8 @@ public class FileNodeManager implements IStatistic, IService {
     }
 
     long start3 = System.currentTimeMillis();
+
+    // check if the file should be closed
     if (bufferWriteProcessor
         .getFileSize() > IoTDBDescriptor.getInstance()
         .getConfig().getBufferwriteFileSizeThreshold()) {