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

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

commit b1588e131785f8a8ef4ac9bd0bee2851c57095da
Author: Haonan <[email protected]>
AuthorDate: Tue Jun 20 11:39:35 2023 +0800

    [To rel/1.2] Flush previous time partition memtable by wal (#10221)
---
 server/src/main/java/org/apache/iotdb/db/wal/WALManager.java |  2 +-
 .../src/main/java/org/apache/iotdb/db/wal/node/WALNode.java  | 12 +++++-------
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java 
b/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
index 36db197dae5..d041114fde9 100644
--- a/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
@@ -202,7 +202,7 @@ public class WALManager implements IService {
   }
 
   public boolean shouldThrottle() {
-    return getTotalDiskUsage() >= config.getThrottleThreshold();
+    return getTotalDiskUsage() >= config.getThrottleThreshold() * 0.8;
   }
 
   public long getTotalDiskUsage() {
diff --git a/server/src/main/java/org/apache/iotdb/db/wal/node/WALNode.java 
b/server/src/main/java/org/apache/iotdb/db/wal/node/WALNode.java
index 4891062e892..8a040a980f1 100644
--- a/server/src/main/java/org/apache/iotdb/db/wal/node/WALNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/wal/node/WALNode.java
@@ -240,13 +240,7 @@ public class WALNode implements IWALNode {
           identifier,
           firstValidVersionId,
           safelyDeletedSearchIndex);
-      boolean pinnedByIoTConsensus = deleteOutdatedFiles();
-      if (pinnedByIoTConsensus) {
-        logger.debug(
-            "Cannot delete wal files for wal node-{} because of wal files are 
pinned by IoTConsensus.",
-            identifier);
-        return;
-      }
+      deleteOutdatedFiles();
 
       // calculate effective information ratio
       long costOfActiveMemTables = 
checkpointManager.getTotalCostOfActiveMemTables();
@@ -277,6 +271,10 @@ public class WALNode implements IWALNode {
           config.getWalMinEffectiveInfoRatio());
       boolean isSuccess = snapshotOrFlushMemTable();
       if (isSuccess && recursionTime < MAX_RECURSION_TIME) {
+        // wal is used to search, cannot optimize files deletion
+        if (safelyDeletedSearchIndex != DEFAULT_SAFELY_DELETED_SEARCH_INDEX) {
+          return;
+        }
         recursionTime++;
         run();
       }

Reply via email to