|
51 | 51 | import java.util.stream.Collectors; |
52 | 52 |
|
53 | 53 | public class SeriesPartitionTable { |
54 | | - |
55 | | - // should only be used in CN scope, in DN scope should directly use |
56 | | - // TimePartitionUtils.getTimePartitionInterval() |
57 | | - private static final long TIME_PARTITION_INTERVAL = |
58 | | - CommonDateTimeUtils.convertMilliTimeWithPrecision( |
59 | | - TimePartitionUtils.getTimePartitionInterval(), |
60 | | - CommonDescriptor.getInstance().getConfig().getTimestampPrecision()); |
61 | | - |
62 | 54 | private final ConcurrentSkipListMap<TTimePartitionSlot, List<TConsensusGroupId>> |
63 | 55 | seriesPartitionMap; |
64 | 56 |
|
@@ -263,13 +255,17 @@ public TConsensusGroupId getLastConsensusGroupId() { |
263 | 255 | */ |
264 | 256 | public List<TTimePartitionSlot> autoCleanPartitionTable( |
265 | 257 | long TTL, TTimePartitionSlot currentTimeSlot) { |
| 258 | + final long timePartitionInterval = |
| 259 | + CommonDateTimeUtils.convertMilliTimeWithPrecision( |
| 260 | + TimePartitionUtils.getTimePartitionInterval(), |
| 261 | + CommonDescriptor.getInstance().getConfig().getTimestampPrecision()); |
266 | 262 | List<TTimePartitionSlot> removedTimePartitions = new ArrayList<>(); |
267 | 263 | Iterator<Map.Entry<TTimePartitionSlot, List<TConsensusGroupId>>> iterator = |
268 | 264 | seriesPartitionMap.entrySet().iterator(); |
269 | 265 | while (iterator.hasNext()) { |
270 | 266 | Map.Entry<TTimePartitionSlot, List<TConsensusGroupId>> entry = iterator.next(); |
271 | 267 | TTimePartitionSlot timePartitionSlot = entry.getKey(); |
272 | | - if (timePartitionSlot.getStartTime() + TIME_PARTITION_INTERVAL + TTL |
| 268 | + if (timePartitionSlot.getStartTime() + timePartitionInterval + TTL |
273 | 269 | <= currentTimeSlot.getStartTime()) { |
274 | 270 | removedTimePartitions.add(timePartitionSlot); |
275 | 271 | iterator.remove(); |
|
0 commit comments