Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

restore: fast fail when backup table's cluster index option is not consistent #685

Merged
merged 9 commits into from
Jan 11, 2021

Conversation

lichunzhu
Copy link
Contributor

What problem does this PR solve?

If we backup table with cluster index option A, restore table with cluster index option B. If A != B, the table data might be corrupted.

What is changed and how it works?

Check table's info with existed tables before exec DDL and restore tables.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  1. Backup tables with tidb_enable_clustered_index=OFF.
  2. Set tidb_enable_clustered_index=ON.
  3. Restore tables through BR and get:
Error: CommonIsHandle: backup table false, existed table true not match: [BR:Restore:ErrRestoreModeMismatch]restore mode mismatch

Code changes

  • Has exported function/method change

Release Note

  • fast fail when backup table's cluster index option is not consistent

@lichunzhu lichunzhu requested review from overvenus, 3pointer and kennytm and removed request for overvenus January 8, 2021 08:57
pkg/restore/client.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@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.

please provide a test case. rest LGTM.

@lichunzhu
Copy link
Contributor Author

/run-all-tests

Copy link
Collaborator

@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.

LGTM

@ti-srebot ti-srebot added the status/LGT1 LGTM1 label Jan 11, 2021
Copy link
Collaborator

@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-srebot ti-srebot removed the status/LGT1 LGTM1 label Jan 11, 2021
@ti-srebot ti-srebot added the status/LGT2 LGTM2 label Jan 11, 2021
@lichunzhu lichunzhu merged commit 0844655 into pingcap:master Jan 11, 2021
@lichunzhu lichunzhu deleted the fastFailClusterIndex branch January 11, 2021 09:27
ti-srebot pushed a commit to ti-srebot/br that referenced this pull request Jan 19, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #706

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants