[Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value#6129
Conversation
|
|
||
| // Check the number of dynamic partitions that need to be created to avoid creating too many partitions at once. | ||
| // If create_history_partition is false, history partition is not considered. | ||
| int expect_create_partition_num; |
| "Invalid dynamic partition create_history_partition: %s. Expected true or false"), | ||
| ERROR_DYNAMIC_PARTITION_HISTORY_PARTITION_NUM_ZERO(5075, new byte[] {'4', '2', '0', '0', '0'}, | ||
| "Dynamic history partition num must greater than 0"), | ||
| ERROR_DYNAMIC_PARTITION_HISTORY_PARTITION_NUM_FORMAT(5076, new byte[] {'4', '2', '0', '0', '0'}, |
|
|
||
| boolean createHistoryPartition = dynamicPartitionProperty.isCreateHistoryPartition(); | ||
| int idx = createHistoryPartition ? dynamicPartitionProperty.getStart() : 0; | ||
| int idx = createHistoryPartition ? -dynamicPartitionProperty.getHistoryPartitionNum() : 0; |
There was a problem hiding this comment.
if createHistoryPartition
if NOT_SET_HISTORY_PARTITION_NUM
idx = start
else
idx = max(start, -historyPartitionNum)
else
idx = 0| this.buckets = Integer.parseInt(properties.get(BUCKETS)); | ||
| this.replicationNum = Integer.parseInt(properties.getOrDefault(REPLICATION_NUM, String.valueOf(NOT_SET_REPLICATION_NUM))); | ||
| this.createHistoryPartition = Boolean.parseBoolean(properties.get(CREATE_HISTORY_PARTITION)); | ||
| this.historyPartitionNum = Integer.parseInt(properties.getOrDefault(HISTORY_PARTITION_NUM, String.valueOf(-start))); |
There was a problem hiding this comment.
default value should be NOT_SET_HISTORY_PARTITION_NUM, not -start. You can refer to NOT_SET_REPLICATION_NUM.
| start = 0; | ||
| expect_create_partition_num = end - start; | ||
| } else { | ||
| if (historyPartitionNum != 0) { |
There was a problem hiding this comment.
Check NOT_SET_HISTORY_PARTITION_NUM
| Dynamic_partition. Prefix: used to specify the partition name prefix to be created, such as the partition name prefix p, automatically creates the partition name p20200108 | ||
|
|
||
| Dynamic_partition. Buckets: specifies the number of partition buckets that are automatically created | ||
|
|
There was a problem hiding this comment.
Consistent with Chinese document format.
| analyzedProperties.put(DynamicPartitionProperty.CREATE_HISTORY_PARTITION, val); | ||
| } | ||
|
|
||
| int historyPartitionNum = 0; |
There was a problem hiding this comment.
It is better to keep the same style as the existing code.
You can refer to REPLICATION_NUM section.
|
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. |
Ok, I have done with these code review issue |
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| import static org.apache.doris.catalog.DynamicPartitionProperty.NOT_SET_HISTORY_PARTITION_NUM; |
There was a problem hiding this comment.
There is no need to import the static value. You can use it directly. DynamicPartitionProperty.NOT_SET_HISTORY_PARTITION_NUM
| // Check the number of dynamic partitions that need to be created to avoid creating too many partitions at once. | ||
| // If create_history_partition is false, history partition is not considered. | ||
| int expect_create_partition_num; | ||
| int expectCreatePartitionNum; |
There was a problem hiding this comment.
You could add some logic explaination here.
| expect_create_partition_num = end - Math.max(start, -historyPartitionNum); | ||
| int historyPartitionNum = Integer.valueOf(analyzedProperties.getOrDefault(DynamicPartitionProperty.HISTORY_PARTITION_NUM, | ||
| String.valueOf(DynamicPartitionProperty.NOT_SET_HISTORY_PARTITION_NUM))); | ||
| if (historyPartitionNum > 0) { |
There was a problem hiding this comment.
| if (historyPartitionNum > 0) { | |
| if (historyPartitionNum != DynamicPartitionProperty.NOT_SET_HISTORY_PARTITION_NUM) { |
|
|
||
| boolean createHistoryPartition = dynamicPartitionProperty.isCreateHistoryPartition(); | ||
| int idx = createHistoryPartition ? dynamicPartitionProperty.getStart() : 0; | ||
| int idx; |
There was a problem hiding this comment.
Some logical explanations can also be added here.
…y_partition and not specify the start value
|
LGTM |
optimize dynamic partition docs. add feature introduced in #6129
…y_partition and not specify the start value (apache#6129) fix the issue apache#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
…error (apache#6129) The doris_cloud.outfile for Cloud will show the warning FoundationDB client ignoring unrecognized knob option 'TLS_CERT_REFRESH_DELAY_SECONDS'. This is because FDB configuration is case-sensitive. The option needs to be in all lowercase, so it has been changed to the lowercase configuration.
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...