Skip to content

[Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value#6129

Merged
morningman merged 1 commit intoapache:masterfrom
harveyyue:5995
Jul 10, 2021
Merged

[Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value#6129
morningman merged 1 commit intoapache:masterfrom
harveyyue:5995

Conversation

@harveyyue
Copy link
Contributor

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 x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in 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...


// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use camel-case code style

"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'},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used?


boolean createHistoryPartition = dynamicPartitionProperty.isCreateHistoryPartition();
int idx = createHistoryPartition ? dynamicPartitionProperty.getStart() : 0;
int idx = createHistoryPartition ? -dynamicPartitionProperty.getHistoryPartitionNum() : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistent with Chinese document format.

analyzedProperties.put(DynamicPartitionProperty.CREATE_HISTORY_PARTITION, val);
}

int historyPartitionNum = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to keep the same style as the existing code.
You can refer to REPLICATION_NUM section.

@qidaye
Copy link
Contributor

qidaye commented Jun 30, 2021

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.

@harveyyue
Copy link
Contributor Author

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

Copy link
Contributor

@qidaye qidaye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thands for your hard work. Left few comments.
Please add some unit tests for your changes.

import java.util.Map;
import java.util.Set;

import static org.apache.doris.catalog.DynamicPartitionProperty.NOT_SET_HISTORY_PARTITION_NUM;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Contributor

@qidaye qidaye Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Contributor

@qidaye qidaye Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (historyPartitionNum > 0) {
if (historyPartitionNum != DynamicPartitionProperty.NOT_SET_HISTORY_PARTITION_NUM) {


boolean createHistoryPartition = dynamicPartitionProperty.isCreateHistoryPartition();
int idx = createHistoryPartition ? dynamicPartitionProperty.getStart() : 0;
int idx;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some logical explanations can also be added here.

@qidaye
Copy link
Contributor

qidaye commented Jul 8, 2021

LGTM

@morningman morningman added area/dynamic-partition kind/fix Categorizes issue or PR as related to a bug. labels Jul 9, 2021
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Jul 9, 2021
@morningman morningman merged commit 65892ce into apache:master Jul 10, 2021
morningman pushed a commit that referenced this pull request Jul 14, 2021
optimize dynamic partition docs.
add feature introduced in #6129
EmmyMiao87 pushed a commit to EmmyMiao87/incubator-doris that referenced this pull request Nov 10, 2021
…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
Hastyshell pushed a commit to Hastyshell/doris that referenced this pull request Dec 29, 2025
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/dynamic-partition kind/fix Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value

3 participants