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

br: modify tables that should be altered auto id or random id #33719

Merged
merged 6 commits into from
Apr 14, 2022

Conversation

WangLe1321
Copy link
Contributor

@WangLe1321 WangLe1321 commented Apr 6, 2022

What problem does this PR solve?

Issue Number: close #33596

Problem Summary:

What is changed and how it works?

We modify tables that should be altered auto_increment or auto_random_base. Tables existed in restored cluster or created by executing ddl job all should be altered during incremental restoration.

As long as we alter auto_increment or auto_random_base in restored table, we can insert records successfully.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
    1. create an empty table a, b, c, d, e (NEXT_GLOBAL_ROW_ID is 1).
    2. insert a few records into b, c, d(NEXT_GLOBAL_ROW_ID is 30001).
    3. do a full backup.
    4. truncate table b, c, drop table d, rename table e to e1.
    5. insert a few records into a, b, e1 via one TiDB instance (NEXT_GLOBAL_ROW_ID is 30001).
    6. do an incremental backup.
    7. do a full restoration to restored cluster.
    8. do an incremental restoration to restored cluster.
    9. insert a few records into a, b, c, d, e successfully, which is the correct result. In this situation, a is the table changed NEXT_GLOBAL_ROW_ID, b is the table truncated, c is the table truncated and changed NEXT_GLOBAL_ROW_ID, d is the table dropped, e1 is the table renamed and changed NEXT_GLOBAL_ROW_ID.

Release note

Fix a bug of duplicate primary key when insert record into table after incremental restoration.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Apr 6, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • joccau

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 needs-cherry-pick-4.0 needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 needs-cherry-pick-release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Type: Need cherry pick to release-5.4 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 6, 2022
@WangLe1321
Copy link
Contributor Author

/cc @joccau

@ti-chi-bot ti-chi-bot requested a review from joccau April 6, 2022 05:14
@WangLe1321
Copy link
Contributor Author

WangLe1321 commented Apr 6, 2022

/cc @3pointer

1 similar comment
@WangLe1321
Copy link
Contributor Author

/cc @3pointer

@ti-chi-bot ti-chi-bot requested a review from 3pointer April 6, 2022 05:15
@sre-bot
Copy link
Contributor

sre-bot commented Apr 6, 2022

br/pkg/restore/client.go Outdated Show resolved Hide resolved
@3pointer
Copy link
Contributor

3pointer commented Apr 6, 2022

I think we need another test case to cover this change.
A test case make sure the former code not work, and this code works.

@joccau
Copy link
Member

joccau commented Apr 6, 2022

/component br

@ti-chi-bot ti-chi-bot added the component/br This issue is related to BR of TiDB. label Apr 6, 2022
@joccau
Copy link
Member

joccau commented Apr 6, 2022

Rest LGTM.
Should test more scenes in backup and incremental backup by Manual test.
Like truncate table/create and rename table with auto_increment ID.

@WangLe1321
Copy link
Contributor Author

/run-integration-br-test

Copy link
Contributor

@3pointer 3pointer 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

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 13, 2022
@WangLe1321
Copy link
Contributor Author

/run-integration-br-test

@3pointer
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 8eb8be3

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 14, 2022
@ti-chi-bot ti-chi-bot merged commit 654e3d8 into pingcap:master Apr 14, 2022
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 14, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #33984

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 14, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #33985

@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 failed

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 14, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #33986

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 14, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 in PR #33987

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 14, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.4 in PR #33988

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 14, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 in PR #33989

@sre-bot
Copy link
Contributor

sre-bot commented Apr 14, 2022

TiDB MergeCI notify

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🟢 all 34 tests passed 40 min Existing passed
idc-jenkins-ci-tidb/integration-br-test 🟢 all 29 tests passed 28 min Existing passed
idc-jenkins-ci-tidb/code-coverage 🟢 Lines coverage: 63.5% 15 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 11 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 8 min 56 sec Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 7 min 43 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 7 min 23 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 7 min 22 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 7 min 3 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 4 min 57 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 4 min 35 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

WangLe1321 added a commit to ti-srebot/tidb that referenced this pull request Apr 28, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
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. needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 needs-cherry-pick-release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Type: Need cherry pick to release-5.4 release-note size/M Denotes a PR that changes 30-99 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.

br: incremental restore should rebase auto increment id even table exists;
6 participants