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 2024/02/26 09:34:18 UTC

(iotdb) branch master updated: Optimize flushing memtable check (#12081)

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

haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 8aeab9f81d1 Optimize flushing memtable check (#12081)
8aeab9f81d1 is described below

commit 8aeab9f81d18fa706ffb427caadc50ac3c90527b
Author: Haonan <hh...@outlook.com>
AuthorDate: Mon Feb 26 17:34:13 2024 +0800

    Optimize flushing memtable check (#12081)
---
 .../src/assembly/resources/conf/iotdb-datanode.properties   |  2 +-
 .../iotdb/db/storageengine/dataregion/DataRegion.java       | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/iotdb-core/datanode/src/assembly/resources/conf/iotdb-datanode.properties b/iotdb-core/datanode/src/assembly/resources/conf/iotdb-datanode.properties
index e6ee742796e..949e3400750 100644
--- a/iotdb-core/datanode/src/assembly/resources/conf/iotdb-datanode.properties
+++ b/iotdb-core/datanode/src/assembly/resources/conf/iotdb-datanode.properties
@@ -313,4 +313,4 @@ dn_metric_prometheus_reporter_port=9092
 # trust_store_pwd=""
 
 # SSL timeout (in seconds)
-# idle_timeout_in_seconds=50000
\ No newline at end of file
+# idle_timeout_in_seconds=50000
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index d5cf0821ba4..e0b853755e3 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -105,7 +105,6 @@ import org.apache.iotdb.db.storageengine.rescon.memory.TimePartitionManager;
 import org.apache.iotdb.db.storageengine.rescon.memory.TsFileResourceManager;
 import org.apache.iotdb.db.storageengine.rescon.quotas.DataNodeSpaceQuotaManager;
 import org.apache.iotdb.db.tools.settle.TsFileAndModSettleTool;
-import org.apache.iotdb.db.utils.CopyOnReadLinkedList;
 import org.apache.iotdb.db.utils.DateTimeUtils;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
@@ -218,12 +217,11 @@ public class DataRegion implements IDataRegionForQuery {
   private final TreeMap<Long, TsFileProcessor> workUnsequenceTsFileProcessors = new TreeMap<>();
 
   /** sequence tsfile processors which are closing. */
-  private final CopyOnReadLinkedList<TsFileProcessor> closingSequenceTsFileProcessor =
-      new CopyOnReadLinkedList<>();
+  private final Set<TsFileProcessor> closingSequenceTsFileProcessor = ConcurrentHashMap.newKeySet();
 
   /** unsequence tsfile processors which are closing. */
-  private final CopyOnReadLinkedList<TsFileProcessor> closingUnSequenceTsFileProcessor =
-      new CopyOnReadLinkedList<>();
+  private final Set<TsFileProcessor> closingUnSequenceTsFileProcessor =
+      ConcurrentHashMap.newKeySet();
 
   /** data region id. */
   private final String dataRegionId;
@@ -1300,6 +1298,11 @@ public class DataRegion implements IDataRegionForQuery {
    * @param tsFileProcessor tsfile processor in which memTable to be flushed
    */
   public void submitAFlushTaskWhenShouldFlush(TsFileProcessor tsFileProcessor) {
+    if (closingSequenceTsFileProcessor.contains(tsFileProcessor)
+        || closingUnSequenceTsFileProcessor.contains(tsFileProcessor)
+        || tsFileProcessor.alreadyMarkedClosing()) {
+      return;
+    }
     writeLock("submitAFlushTaskWhenShouldFlush");
     try {
       // check memtable size and may asyncTryToFlush the work memtable