You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/10/17 07:00:48 UTC
[iotdb] 01/01: [IOTDB-4636] Add check to avoid flush empty chunk group
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch Avoid_flush_empty_chunkGroupmas
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 745ef518970f2d18430608074381dd2018b9b006
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Oct 17 15:00:11 2022 +0800
[IOTDB-4636] Add check to avoid flush empty chunk group
---
.../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 a86380749d..2653d67eac 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,14 +122,20 @@ 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()));
List<String> seriesInOrder = new ArrayList<>(value.keySet());
seriesInOrder.sort((String::compareTo));
for (String seriesId : seriesInOrder) {
long startTime = System.currentTimeMillis();
IWritableMemChunk series = value.get(seriesId);
+ if (series.count() == 0) {
+ continue;
+ }
/*
* sort task (first task of flush pipeline)
*/