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

jt2594838 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 2f9f9cab1b7 Fix TTL expired data ratio in settle compaction (#18777)
2f9f9cab1b7 is described below

commit 2f9f9cab1b7e89c0eca44eb0273f9935b35bf791
Author: Hongzhi Gao <[email protected]>
AuthorDate: Wed Sep 30 17:23:36 2026 +0800

    Fix TTL expired data ratio in settle compaction (#18777)
---
 .../dataregion/compaction/selector/impl/SettleSelectorImpl.java      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
index b08c032d483..61f8229cd3c 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/selector/impl/SettleSelectorImpl.java
@@ -290,7 +290,7 @@ public class SettleSelectorImpl implements ISettleSelector {
             // overflow, like 100 - Long.MIN
             outdatedTimeDiff = Long.MAX_VALUE;
           }
-          long ttlThreshold = 3 * ttl > ttl ? ttl : Long.MAX_VALUE;
+          long ttlThreshold = ttl <= Long.MAX_VALUE / 3 ? 3 * ttl : 
Long.MAX_VALUE;
           hasExpiredTooLong =
               hasExpiredTooLong
                   || outdatedTimeDiff > Math.min(config.getMaxExpiredTime(), 
ttlThreshold);
@@ -309,7 +309,8 @@ public class SettleSelectorImpl implements ISettleSelector {
       return new FileDirtyInfo(DirtyStatus.FULLY_DIRTY, ttlTables);
     }
     hasExpiredTooLong = config.getMaxExpiredTime() != Long.MAX_VALUE && 
hasExpiredTooLong;
-    if (hasExpiredTooLong || deletedDeviceRatio >= 
config.getExpiredDataRatio()) {
+    if (hasExpiredTooLong
+        || (deletedDeviceRatio > 0 && deletedDeviceRatio >= 
config.getExpiredDataRatio())) {
       // evaluate dirty data size in the tsfile
       return new FileDirtyInfo(
           PARTIALLY_DIRTY, (long) (deletedDeviceRatio * 
resource.getTsFileSize()), ttlTables);

Reply via email to