CRZbulabula commented on PR #14737:
URL: https://github.com/apache/iotdb/pull/14737#issuecomment-2606632528

   > Have you considered concurrency issues, such as setTTL and Cleaner running 
simultaneously?
   > 
   > (I think one solution could be to clean up partitions only after they’ve 
exceeded the TTL by one hour, but you might have solved this in another way :)
   
   Thanks for raising this critical issue. To address your concern, please 
refer to the `autoCleanPartitionTable` in the `SeriesPartitionTable`, as 
outlined below:
   
   ```
   public void autoCleanPartitionTable(long TTL, TTimePartitionSlot 
currentTimeSlot) {
       seriesPartitionMap
           .entrySet()
           .removeIf(entry -> entry.getKey().getStartTime() + TTL < 
currentTimeSlot.getStartTime());
     }
   ```
   
   Here, the removing condition is `<` rather than `<=`. As a result, a data 
partition is removed from cache only when it exceeded the TTL by a whole time 
partitioning interval. Therefore, the PartitionTable always contains a row of 
"empty" data partitions. I believe this approach can avoid this concurrency 
problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to