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: add resotre auto inc id for incremental restore #29021

Merged
merged 17 commits into from
Oct 26, 2021

Conversation

3pointer
Copy link
Contributor

What problem does this PR solve?

Problem Summary:

After #27199 merged. The incremental restore will lost the correct auto increment id cache. Because, we will create table twice during incremental restoration. since we cannot use OnExistReplace option on createTable. so we execute the first create table DDL will lost the real auto id cache during incremental restoration.

What is changed and how it works?

This PR bring the old logic back. even we only can restore create table DDL at first time. but we can execute alter auto id SQL to set the correct auto id cache.

Check List

Tests

  • Integration test

Release note

Fix the issue that incremental restore lost the auto increment/auto random id cache.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 21, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • YuJuncen
  • kennytm

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 21, 2021
@3pointer 3pointer added the component/br This issue is related to BR of TiDB. label Oct 21, 2021
@3pointer
Copy link
Contributor Author

/run-integration-br-test

1 similar comment
@3pointer
Copy link
Contributor Author

/run-integration-br-test

@kennytm
Copy link
Contributor

kennytm commented Oct 21, 2021

please add a test

@3pointer 3pointer changed the title restore: add resotre auto inc id for incremental restore WIP: restore: add resotre auto inc id for incremental restore Oct 21, 2021
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 21, 2021
@3pointer
Copy link
Contributor Author

please add a test

Actually we had an integration test br_incremental_ddl. and it fails already. Let me add more tests for this case later.

@3pointer
Copy link
Contributor Author

/run-integration-br-test

@3pointer
Copy link
Contributor Author

/run-integration-br-test

@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 21, 2021
@3pointer 3pointer changed the title WIP: restore: add resotre auto inc id for incremental restore restore: add resotre auto inc id for incremental restore Oct 21, 2021
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 21, 2021
@3pointer 3pointer requested review from kennytm and YuJuncen October 21, 2021 13:44
@3pointer
Copy link
Contributor Author

/run-integration-br-test

1 similar comment
@3pointer
Copy link
Contributor Author

/run-integration-br-test

@3pointer 3pointer force-pushed the fix_restore_incremental_auto_cache branch from 3bf9597 to 9aac1db Compare October 25, 2021 03:47
@3pointer
Copy link
Contributor Author

/run-integration-br-test

@3pointer
Copy link
Contributor Author

/run-integration-br-test

@3pointer
Copy link
Contributor Author

/run-integration-br-test

@3pointer
Copy link
Contributor Author

/run-integration-br-test

1 similar comment
@3pointer
Copy link
Contributor Author

/run-integration-br-test

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 25, 2021
@3pointer 3pointer force-pushed the fix_restore_incremental_auto_cache branch from 0416bba to 0e3f669 Compare October 25, 2021 09:37
@3pointer
Copy link
Contributor Author

/run-integration-br-test

@3pointer
Copy link
Contributor Author

/run-integration-br-test

Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

Rest lgtm

br/pkg/restore/client.go Outdated Show resolved Hide resolved
@@ -406,11 +406,12 @@ func (rc *Client) createTable(
dom *domain.Domain,
table *metautil.Table,
newTS uint64,
ddlTables map[UniqueTableName]bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the value be struct{} instead of bool?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if change it to struct{} then next statement in switch...case should change. https://github.com/pingcap/tidb/pull/29021/files#diff-6aa3f356317f5e47c13ad7dd73465a1cf4a550052819ffe40448e545bf857bf5R171
I think bool is better.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 25, 2021
@3pointer
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 1b2d157

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 26, 2021
@3pointer
Copy link
Contributor Author

/run-check_dev_2

1 similar comment
@3pointer
Copy link
Contributor Author

/run-check_dev_2

@ti-chi-bot
Copy link
Member

@3pointer: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit fd764aa into pingcap:master Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/br This issue is related to BR of TiDB. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants