Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore: rewrite auto increment id after pitr #46521

Merged
merged 9 commits into from
Sep 4, 2023

Conversation

3pointer
Copy link
Contributor

@3pointer 3pointer commented Aug 30, 2023

What problem does this PR solve?

Issue Number: close #46520

Problem Summary:

After we seperate auto_increment and tidb_rowid. pitr didn't handle the tidb_rowid correctly. This PR fixed it. and add a new restriction about TableVersionInfo. When model.CurrLatestTableInfoVersion updated. backup and restore need to check carefully about compatibility.

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    the same steps as description is issue.
    and check the result.

backup cluster:
image

restore cluster:
image

  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

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

Fix the issue that pitr will lost auto-increment id allocator update after table rewrite during restore

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 30, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 30, 2023
@tiprow
Copy link

tiprow bot commented Aug 30, 2023

Hi @3pointer. 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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer 3pointer marked this pull request as ready for review August 30, 2023 09:12
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 30, 2023
@3pointer 3pointer changed the title restore: rewrite auto increment id after restore: rewrite auto increment id after pitr Aug 30, 2023
meta/meta.go Outdated
@@ -316,6 +316,26 @@ func (*Meta) autoIncrementIDKey(tableID int64) []byte {
return []byte(fmt.Sprintf("%s:%d", mIncIDPrefix, tableID))
Copy link
Contributor

Choose a reason for hiding this comment

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

call the AutoIncrementIDKey instead.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 30, 2023
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Merging #46521 (34ef3f1) into master (be5ce3d) will decrease coverage by 0.5979%.
Report is 3 commits behind head on master.
The diff coverage is 24.2424%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46521        +/-   ##
================================================
- Coverage   73.3443%   72.7465%   -0.5979%     
================================================
  Files          1310       1331        +21     
  Lines        394945     401912      +6967     
================================================
+ Hits         289670     292377      +2707     
- Misses        86842      91053      +4211     
- Partials      18433      18482        +49     
Flag Coverage Δ
integration 25.4390% <6.0606%> (?)
unit 73.4334% <24.2424%> (+0.0890%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 84.9628% <ø> (+0.0108%) ⬆️
br 48.0180% <0.0000%> (-4.3104%) ⬇️

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 31, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Leavrth, tiancaiamao

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Leavrth,tiancaiamao]

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 ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 31, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 31, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-30 09:23:14.880472203 +0000 UTC m=+1918959.429488190: ☑️ agreed by Leavrth.
  • 2023-08-31 08:01:20.588499419 +0000 UTC m=+2000445.137515403: ☑️ agreed by tiancaiamao.

@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. and removed do-not-merge/needs-triage-completed labels Sep 1, 2023
@3pointer
Copy link
Contributor Author

3pointer commented Sep 1, 2023

/test mysql-test

@tiprow
Copy link

tiprow bot commented Sep 1, 2023

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

In response to this:

/test mysql-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer
Copy link
Contributor Author

3pointer commented Sep 1, 2023

/test unit-test

@hawkingrei
Copy link
Member

/test all

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/retest

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

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

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Sep 4, 2023
@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@3pointer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@3pointer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/ok-to-test

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/test check-dev2

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@3pointer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/test check-dev2

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/run-check_dev_2

@tiprow
Copy link

tiprow bot commented Sep 4, 2023

@3pointer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/run-check_dev_2

@3pointer
Copy link
Contributor Author

3pointer commented Sep 4, 2023

/test tiprow_fast_test

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 4, 2023

@3pointer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test canary-scan-security
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-br-integration-test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-ddl-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-prisma-test
  • /test pull-mysql-connector-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pull-notify-when-compatibility-sections-changed

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test

In response to this:

/test tiprow_fast_test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit e82519e into pingcap:master Sep 4, 2023
8 of 12 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #46634.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Sep 4, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #46635.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Sep 4, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Sep 4, 2023
ti-chi-bot bot pushed a commit that referenced this pull request Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Encounter Duplicated entry error after pitr with non-primary-key table.
5 participants