You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2025/05/14 08:11:36 UTC
(iotdb) branch AutoCleanBug-1.3 created (now 1a5f7c92a8a)
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a change to branch AutoCleanBug-1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 1a5f7c92a8a Fix auto cleaning partition table bug
This branch includes the following new commits:
new 1a5f7c92a8a Fix auto cleaning partition table bug
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Fix auto cleaning partition table bug
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch AutoCleanBug-1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 1a5f7c92a8aac7b013aa23e9693ba87ed59808a0
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Wed May 14 16:09:32 2025 +0800
Fix auto cleaning partition table bug
---
.../apache/iotdb/commons/partition/SeriesPartitionTable.java | 12 ++++++++----
1 file changed, 8 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..069ecaf793d 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,11 +50,14 @@ 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;
+
public SeriesPartitionTable() {
this.seriesPartitionMap = new ConcurrentSkipListMap<>();
}
@@ -255,7 +259,7 @@ 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();
}