This is an automated email from the ASF dual-hosted git repository.
jackietien 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 145d87da438 Fix auto cleaning partition table bug
145d87da438 is described below
commit 145d87da438c90380b2ebb32fcf0591d800b50b4
Author: Jackie Tien <[email protected]>
AuthorDate: Wed May 14 19:41:46 2025 +0800
Fix auto cleaning partition table bug
---
.../iotdb/commons/partition/SeriesPartitionTable.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
index f99d06c9c0d..f46344566dc 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/SeriesPartitionTable.java
@@ -22,14 +22,15 @@ package org.apache.iotdb.commons.partition;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
+import org.apache.iotdb.commons.conf.CommonDescriptor;
+import org.apache.iotdb.commons.utils.CommonDateTimeUtils;
import org.apache.iotdb.commons.utils.ThriftCommonsSerDeUtils;
+import org.apache.iotdb.commons.utils.TimePartitionUtils;
import org.apache.iotdb.confignode.rpc.thrift.TTimeSlotList;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;
import org.apache.tsfile.utils.ReadWriteIOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@@ -49,7 +50,12 @@ import java.util.stream.Collectors;
public class SeriesPartitionTable {
- private static final Logger LOGGER =
LoggerFactory.getLogger(SeriesPartitionTable.class);
+ // should only be used in CN scope, in DN scope should directly use
+ // TimePartitionUtils.getTimePartitionInterval()
+ private static final long TIME_PARTITION_INTERVAL =
+ CommonDateTimeUtils.convertMilliTimeWithPrecision(
+ TimePartitionUtils.getTimePartitionInterval(),
+ CommonDescriptor.getInstance().getConfig().getTimestampPrecision());
private final ConcurrentSkipListMap<TTimePartitionSlot,
List<TConsensusGroupId>>
seriesPartitionMap;
@@ -255,7 +261,8 @@ public class SeriesPartitionTable {
while (iterator.hasNext()) {
Map.Entry<TTimePartitionSlot, List<TConsensusGroupId>> entry =
iterator.next();
TTimePartitionSlot timePartitionSlot = entry.getKey();
- if (timePartitionSlot.getStartTime() + TTL <
currentTimeSlot.getStartTime()) {
+ if (timePartitionSlot.getStartTime() + TIME_PARTITION_INTERVAL + TTL
+ <= currentTimeSlot.getStartTime()) {
removedTimePartitions.add(timePartitionSlot);
iterator.remove();
}