ohye3166 opened a new issue, #62348:
URL: https://github.com/apache/doris/issues/62348

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   doris-3.1.4-rc02-7f5ba43de6
   
   ### What's Wrong?
   
   When using AUTO PARTITION with dynamic_partition.enable = false, historical 
partitions cannot be automatically cleaned up according to the 
dynamic_partition.start configuration.Partition cleanup only works after 
setting dynamic_partition.enable = true, but this will lead to inconsistent 
partition names.
   
   ### What You Expected?
   
   When using AUTO PARTITION and setting dynamic_partition.enable = false, the 
system should automatically clean up historical partitions based on the 
dynamic_partition.start and dynamic_partition.time_unit configurations, while 
keeping the partition names consistent (without enabling dynamic partition 
which causes name inconsistency).
   
   ### How to Reproduce?
   
   1.Create a table with AUTO PARTITION and set dynamic_partition.enable = 
"false":
   CREATE TABLE auto_partition_cleanup_bug (
       dt DATE NOT NULL, id INT, val STRING
   )
   AUTO PARTITION BY RANGE (date_trunc(dt, 'day')) ()
   DISTRIBUTED BY HASH(id) BUCKETS 1
   PROPERTIES (
       'replication_num' = '1',
       'dynamic_partition.enable' = 'false',
       'dynamic_partition.time_unit' = 'DAY',
       'dynamic_partition.start' = '-3',
       'dynamic_partition.end' = '0',
       'dynamic_partition.prefix' = 'p'
   );
   
   2.Insert test data covering old and recent dates:
   INSERT INTO auto_partition_cleanup_bug VALUES
   ('2026-03-31', 1, 'very_old_10d'),
   ('2026-04-03', 2, 'old_7d'),
   ('2026-04-05', 3, 'old_5d'),
   ('2026-04-07', 4, 'within_3d'),
   ('2026-04-09', 5, 'yesterday'),
   ('2026-04-10', 6, 'today');
   
   3.Reduce the dynamic partition check interval:
   ADMIN SET FRONTEND CONFIG ('dynamic_partition_check_interval_seconds' = 
'10');
   
   
   4.Wait for the check task to run:
   SELECT SLEEP(30);
   
   
   5.Check partitions and find no partitions are deleted (still 6 partitions):
   SHOW PARTITIONS FROM auto_partition_cleanup_bug;
   
   
   6.Enable dynamic_partition.enable = "true":
   ALTER TABLE auto_partition_cleanup_bug SET ('dynamic_partition.enable' = 
'true');
   
   
   7.Wait again:
   SELECT SLEEP(30);
   
   
   8.Check partitions again and find partitions are deleted correctly (only 3 
left)
   SHOW PARTITIONS FROM auto_partition_cleanup_bug;
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to