Skip to content

Commit 8f92ecd

Browse files
authored
[To rel/0.13][IOTDB-4636] Add check to avoid flush empty chunk group (#7598)
1 parent 805eccd commit 8f92ecd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,18 @@ public void syncFlushMemTable() throws ExecutionException, InterruptedException
122122
// sort the IDeviceID in lexicographical order
123123
deviceIDList.sort(Comparator.comparing(IDeviceID::toStringID));
124124
for (IDeviceID deviceID : deviceIDList) {
125-
encodingTaskQueue.put(new StartFlushGroupIOTask(deviceID.toStringID()));
126-
127125
final Map<String, IWritableMemChunk> value = memTableMap.get(deviceID).getMemChunkMap();
126+
// skip the empty device/chunk group
127+
if (memTableMap.get(deviceID).count() == 0 || value.isEmpty()) {
128+
continue;
129+
}
130+
encodingTaskQueue.put(new StartFlushGroupIOTask(deviceID.toStringID()));
128131
for (Map.Entry<String, IWritableMemChunk> iWritableMemChunkEntry : value.entrySet()) {
129132
long startTime = System.currentTimeMillis();
130133
IWritableMemChunk series = iWritableMemChunkEntry.getValue();
134+
if (series.count() == 0) {
135+
continue;
136+
}
131137
/*
132138
* sort task (first task of flush pipeline)
133139
*/

0 commit comments

Comments
 (0)