This is an automated email from the ASF dual-hosted git repository.
tanxinyu 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 6b2e4b15925 Fix effective ratio calculation method (#12394)
6b2e4b15925 is described below
commit 6b2e4b15925ab4f5e7cdc65a3b53daa077804850
Author: Alan Choo <[email protected]>
AuthorDate: Tue Apr 23 18:58:02 2024 +0800
Fix effective ratio calculation method (#12394)
---
.../apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
index 0a581c089c8..88bab379209 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
@@ -227,7 +227,7 @@ public class WALNode implements IWALNode {
private static final int MAX_RECURSION_TIME = 5;
// the effective information ratio
- private double effectiveInfoRatio = 0d;
+ private double effectiveInfoRatio = 1.0d;
private List<Long> pinnedMemTableIds;
@@ -327,14 +327,15 @@ public class WALNode implements IWALNode {
MemTableInfo oldestUnpinnedMemTableInfo =
checkpointManager.getOldestUnpinnedMemTableInfo();
long avgFileSize =
getFileNum() != 0
- ? getTotalSize() / getFileNum()
+ ? getDiskUsage() / getFileNum()
: config.getWalFileSizeThresholdInByte();
long totalCost =
oldestUnpinnedMemTableInfo == null
? costOfActiveMemTables
: (getCurrentWALFileVersion() -
oldestUnpinnedMemTableInfo.getFirstFileVersionId())
* avgFileSize;
- if (totalCost == 0) {
+ if (costOfActiveMemTables == 0 || totalCost == 0) {
+ effectiveInfoRatio = 1.0d;
return;
}
effectiveInfoRatio = (double) costOfActiveMemTables / totalCost;