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 2022/10/14 09:44:55 UTC

[iotdb] branch rel/0.13 updated: [To rel/0.13][IOTDB-4636] Add check to avoid flush empty chunk group (#7598)

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

qiaojialin pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.13 by this push:
     new 8f92ecdf8f [To rel/0.13][IOTDB-4636] Add check to avoid flush empty chunk group (#7598)
8f92ecdf8f is described below

commit 8f92ecdf8f179778e4b072312e15ae440f2cc84f
Author: Haonan <hh...@outlook.com>
AuthorDate: Fri Oct 14 17:44:49 2022 +0800

    [To rel/0.13][IOTDB-4636] Add check to avoid flush empty chunk group (#7598)
---
 .../org/apache/iotdb/db/engine/flush/MemTableFlushTask.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java b/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
index 062555c6f1..f4caf0efaa 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
@@ -122,12 +122,18 @@ public class MemTableFlushTask {
     // sort the IDeviceID in lexicographical order
     deviceIDList.sort(Comparator.comparing(IDeviceID::toStringID));
     for (IDeviceID deviceID : deviceIDList) {
-      encodingTaskQueue.put(new StartFlushGroupIOTask(deviceID.toStringID()));
-
       final Map<String, IWritableMemChunk> value = memTableMap.get(deviceID).getMemChunkMap();
+      // skip the empty device/chunk group
+      if (memTableMap.get(deviceID).count() == 0 || value.isEmpty()) {
+        continue;
+      }
+      encodingTaskQueue.put(new StartFlushGroupIOTask(deviceID.toStringID()));
       for (Map.Entry<String, IWritableMemChunk> iWritableMemChunkEntry : value.entrySet()) {
         long startTime = System.currentTimeMillis();
         IWritableMemChunk series = iWritableMemChunkEntry.getValue();
+        if (series.count() == 0) {
+          continue;
+        }
         /*
          * sort task (first task of flush pipeline)
          */