jt2594838 commented on code in PR #18918:
URL: https://github.com/apache/iotdb/pull/18918#discussion_r4322123503


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/rescon/memory/SystemInfo.java:
##########
@@ -137,7 +137,18 @@ public synchronized boolean reportStorageGroupStatus(
           totalStorageGroupMemCost,
           REJECT_THRESHOLD);
       rejected = true;
-      if (chooseMemTablesToMarkFlush(tsFileProcessor)) {
+      boolean currentProcessorSelected = 
chooseMemTablesToMarkFlush(tsFileProcessor);
+      if (!currentProcessorSelected
+          && tsFileProcessor != null
+          && tsFileProcessor.getWorkMemTable() != null) {
+        // The writer holds its region's write lock. Waiting for another 
processor in that region
+        // to flush would prevent the flush submitter from acquiring the same 
lock. Let this writer
+        // finish and flush its own memtable, subject to the hard memory limit 
below.
+        tsFileProcessor.setWorkMemTableShouldFlush();
+        flushTaskSubmitThreadPool.submit(tsFileProcessor::submitAFlushTask);
+        currentProcessorSelected = true;
+      }
+      if (currentProcessorSelected) {

Review Comment:
   This may result in flushing many small files.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to