[Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value#5996
[Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value#5996harveyyue wants to merge 1 commit intoapache:masterfrom
Conversation
…y_partition and not specify the start value (apache#5995)
|
Hi @harveyyue Thank for your PR. |
when enable the property "dynamic_partition.create_history_partition" and not set property "dynamic_partition.start" 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. 2021-06-08 12:19:21,255 WARN (doris-mysql-nio-pool-0|147) [DynamicPartitionScheduler.getAddPartitionClause():169] Error in gen addPartitionKeyRange. Error=errCode = 2, detailMessage = date literal [+178951742-12-01] is invalid, db: default_cluster:poc, table: dwd_tf_order2 |
|
Hi @harveyyue , thanks for your PR.
Depending on your needs, it is necessary to add the Control the behavior of automatic history partition creation based on the three parameters, Here's the suggested logic pseudocode: 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: 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, for both Chinese and English. If you have any questions , feel free to reach out. |
fix the issue #5995
Add the property "dynamic_partition.history_partition_num" to specify the history partition number when enable create_history_partition to fix the invalid date format value
and add these two properties to docs
Proposed changes
Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.
Types of changes
What types of changes does your code introduce to Doris?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...