You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/06/19 14:59:28 UTC
[iotdb] 01/01: fix the bug that wal cannot be removed
This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch fix_wal_no_delete
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 974a2a64f770e2bb46ce11e4cc2009799296fcf6
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Mon Jun 19 22:58:57 2023 +0800
fix the bug that wal cannot be removed
---
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();
}