qidaye commented on pull request #5996:
URL: https://github.com/apache/incubator-doris/pull/5996#issuecomment-870451825


   Hi @harveyyue , thanks for your PR.
   > one more thing, i want to keep 100 partitions with set 
dynamic_partition.start=-100, and want to create 20 old partitions rather than 
getting 100 old partitions.
   
   Depending on your needs, it is necessary to add the 
`dynamic_partition.history_partition_num` parameter. But there is no need to 
set default value for `history_partition_num`.
   
   Control the behavior of automatic history partition creation based on the 
three parameters,  `start`,`create_history_partition`,`history_partition_num`.
   
   Here's the suggested logic pseudocode:
   
   ```java
   expect_create_partition_num;
   
   if (!create_history_partition) {
     start = 0;
     expect_create_partition_num = end - start;
   } else {
     if (history_partition_num != 0) {
       expect_create_partition_num = end - MAX(start, -history_partition_num);
     } else {
       if (start == Integer.MIN_VALUE) {
         throw exception
       }
       expect_create_partition_num = end - start;
   }
   
   if (expect_create_partition_num > max_dynamic_partition_num) {
     throw exception
   }
   ```
   
   You can add this logic in function: 
https://github.com/apache/incubator-doris/blob/ba84eacb8c2d0d70bff9fc43f7d13b7382384aed/fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java#L295
   
   Here is detail code: 
   
https://github.com/apache/incubator-doris/blob/ba84eacb8c2d0d70bff9fc43f7d13b7382384aed/fe/fe-core/src/main/java/org/apache/doris/common/util/DynamicPartitionUtil.java#L351-L359
   
   By the way, you also need to update dynamic partition doc 
[https://github.com/apache/incubator-doris/blob/master/docs/en/administrator-guide/dynamic-partition.md](url),
 for both Chinese and English.
   
   If you have any questions , feel free to reach out.


-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to