pingcap / tidb

TiDB - the open-source, cloud-native, distributed SQL database designed for modern applications.
https://pingcap.com
Apache License 2.0
37.34k stars 5.85k forks source link

ddl: Fixed partitioning a non-partitioned table with placement rules #57560

Open mjonss opened 2 days ago

mjonss commented 2 days ago

What problem does this PR solve?

Issue Number: close #55705

Problem Summary: When updating the placement rule bundle, the table ID was included both as the table and the partition id.

What changed and how does it work?

Not adding it as partition id for non-partitioned table (which uses the original table as a single partition, hence the same ID).

Also simplified the bundle handling during schema update / ApplyDiff, by removing logic that:

to

For REORGANIZE PARTITION, there the bundles will be updated twice, first with the intermediate set of partitions (both old and new), so that data copying and index creations on the new partitions will follow the correct policies directly, and then with the final partition set, avoiding having to move the data again when the DDL is done.

Check List

Tests

Side effects

Documentation

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

fixed an issue with partitioning a non-partitioned table with placement rules.
tiprow[bot] commented 2 days ago

Hi @mjonss. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
codecov[bot] commented 2 days ago

Codecov Report

Attention: Patch coverage is 83.33333% with 17 lines in your changes missing coverage. Please review.

Project coverage is 74.8011%. Comparing base (ad5ca42) to head (2f97ac7). Report is 31 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #57560 +/- ## ================================================ + Coverage 72.8329% 74.8011% +1.9681% ================================================ Files 1676 1721 +45 Lines 463539 478136 +14597 ================================================ + Hits 337609 357651 +20042 + Misses 105125 98140 -6985 - Partials 20805 22345 +1540 ``` | [Flag](https://app.codecov.io/gh/pingcap/tidb/pull/57560/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/pingcap/tidb/pull/57560/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `49.2534% <66.6666%> (?)` | | | [unit](https://app.codecov.io/gh/pingcap/tidb/pull/57560/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `72.2204% <83.3333%> (+0.0011%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/pingcap/tidb/pull/57560/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | Coverage Δ | | |---|---|---| | [dumpling](https://app.codecov.io/gh/pingcap/tidb/pull/57560/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `52.7673% <ø> (ø)` | | | [parser](https://app.codecov.io/gh/pingcap/tidb/pull/57560/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `∅ <ø> (∅)` | | | [br](https://app.codecov.io/gh/pingcap/tidb/pull/57560/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pingcap) | `60.9294% <ø> (+15.5728%)` | :arrow_up: |

🚨 Try these New Features:

ti-chi-bot[bot] commented 2 days ago

[LGTM Timeline notifier]

Timeline:

ti-chi-bot[bot] commented 1 day ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Defined2014 Once this PR has been reviewed and has the lgtm label, please assign gmhdbjd for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[pkg/ddl/OWNERS](https://github.com/pingcap/tidb/blob/master/pkg/ddl/OWNERS)** - **[pkg/domain/OWNERS](https://github.com/pingcap/tidb/blob/master/pkg/domain/OWNERS)** - **[pkg/infoschema/OWNERS](https://github.com/pingcap/tidb/blob/master/pkg/infoschema/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
ti-chi-bot[bot] commented 1 day ago

@Defined2014: Your lgtm message is repeated, so it is ignored.

In response to [this](https://github.com/pingcap/tidb/pull/57560#pullrequestreview-2450112314): > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
lcwangchao commented 1 day ago

@xhebox PTAL

mjonss commented 1 hour ago

/retest

tiprow[bot] commented 1 hour ago

@mjonss: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to [this](https://github.com/pingcap/tidb/pull/57560#issuecomment-2494087297): >/retest Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.