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

log-backup: restore meta kv with batch method #37100

Merged
merged 9 commits into from
Aug 16, 2022

Conversation

joccau
Copy link
Member

@joccau joccau commented Aug 15, 2022

Signed-off-by: joccau [email protected]

What problem does this PR solve?

Issue Number: close #37111

Problem Summary:

  • Failed to restore index after PiTR to down-stream cluster.
  • The current reason for this issue is that the same meta KV appears multiple times and is overwritten by the old KV record after restoring to the latest tableInfo.

What is changed and how it works?

Set a lots of batch kv files and sort and restore these kv entries in batch files.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Manual test

  • reproduce the test in log-backup: failed to restore index using PiTR #37111
  • The result after PiTR with old code
    MySQL [(none)]> show create table test.sbtest43; | sbtest43 | CREATE TABLEsbtest43(idint(11) NOT NULL AUTO_INCREMENT,kint(11) NOT NULL DEFAULT '0',cchar(120) NOT NULL DEFAULT '',pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=1019915 |
  • The result after PiTR with modified code
    MySQL [(none)]> show create table test.sbtest43; | sbtest43 | CREATE TABLEsbtest43(idint(11) NOT NULL AUTO_INCREMENT,kint(11) NOT NULL DEFAULT '0',cchar(120) NOT NULL DEFAULT '',pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id) /*T![clustered_index] CLUSTERED */, KEY k_43 (k) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=1019915 |

The Key K-43(``) has been restored in above test.

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.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 15, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3pointer
  • Leavrth

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 do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 15, 2022
@pingcap pingcap deleted a comment from ti-chi-bot Aug 15, 2022
@ti-chi-bot
Copy link
Member

@joccau: The label(s) wip cannot be applied. These labels are supported: challenge-program, compatibility-breaker, first-time-contributor, contribution, require-LGT3, good first issue, correctness, duplicate, proposal, security, needs-more-info, needs-cherry-pick-4.0, needs-cherry-pick-5.0, needs-cherry-pick-5.1, needs-cherry-pick-5.2, needs-cherry-pick-5.3, needs-cherry-pick-5.4, needs-cherry-pick-6.0, needs-cherry-pick-6.1, needs-cherry-pick-6.2, affects-4.0, affects-5.0, affects-5.1, affects-5.2, affects-5.3, affects-5.4, affects-6.0, affects-6.1, affects-6.2, may-affects-4.0, may-affects-5.0, may-affects-5.1, may-affects-5.2, may-affects-5.3, may-affects-5.4, may-affects-6.0, may-affects-6.1, may-affects-6.2.

In response to this:

/label WIP

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.

@joccau joccau changed the title log-backup: restore meta kv with batch method log-backup: restore meta kv with batch method(Draft) Aug 15, 2022
@joccau joccau force-pushed the fix-restore-dup-metakv branch 4 times, most recently from e2fc5e7 to a11eee4 Compare August 15, 2022 09:19
@sre-bot
Copy link
Contributor

sre-bot commented Aug 15, 2022

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 15, 2022
Signed-off-by: joccau <[email protected]>
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. do-not-merge/needs-triage-completed needs-cherry-pick-6.2 and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/needs-linked-issue do-not-merge/needs-triage-completed labels Aug 15, 2022
@hawkingrei
Copy link
Member

/run-all-tests

1 similar comment
@hawkingrei
Copy link
Member

/run-all-tests

@3pointer 3pointer changed the title log-backup: restore meta kv with batch method(Draft) log-backup: restore meta kv with batch method Aug 16, 2022
br/pkg/restore/client.go Outdated Show resolved Hide resolved
br/pkg/restore/client.go Show resolved Hide resolved
br/pkg/restore/client.go Outdated Show resolved Hide resolved
@joccau
Copy link
Member Author

joccau commented Aug 16, 2022

/cc @YuJuncen PTAL

@ti-chi-bot
Copy link
Member

@joccau: GitHub didn't allow me to request PR reviews from the following users: PTAL.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @YuJuncen PTAL

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.

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.

LGTM

@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 Aug 16, 2022
@joccau
Copy link
Member Author

joccau commented Aug 16, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: a438eb0

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 16, 2022
@ti-chi-bot ti-chi-bot merged commit 477f3a2 into pingcap:master Aug 16, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Aug 16, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [1] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🟥 31 min New failing
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 13 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 17 tests passed 13 min Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 7 min 3 sec Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 6 min 38 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 6 min 12 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 6 min 2 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 22 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 46 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

joccau added a commit to joccau/tidb that referenced this pull request Aug 16, 2022
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 16, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-6.2 in PR #37139

@joccau joccau deleted the fix-restore-dup-metakv branch November 28, 2022 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 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.

log-backup: failed to restore index using PiTR
7 participants