This is an automated email from the ASF dual-hosted git repository. JackieTien97 pushed a commit to branch rc/2.0.12 in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 16c5fc88a2450206971d682a9747e7553bf99ef8 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);
