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

br/restore: add version check for backup schema_version (#929) #1091

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #929

What problem does this PR solve?

a special fix for v4.0 versions of #790

Because #685 cannot be cherry-picked to release-4.0, 4.0.x BR would corrupt 4.0 clusters without even a warn message when the backup archive come from a table with non-int clustered primary key. This PR would add a check to the backup archive version, and intercept restoring from incompatible backup archives.

What is changed and how it works?

CheckClusterVersion was changed to check version in different way.
And added a check to cluster version stored in backupmeta during restore. (after reading backup meta)

Currently, this check only checks major versions (because of clustered index).

Check List

Tests

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

Code changes

  • Has exported function/method change
    signature change for CheckClusterVersion.
- CheckClusterVersion(ctx context.Context, client pd.Client) error
+ CheckClusterVersion(ctx context.Context, client pd.Client, checker VerChecker) error

Release Note

  • BR would check cluster version of backup now.

@ZipFast
Copy link
Contributor

ZipFast commented May 10, 2021

/run-all-tests

@@ -6,6 +6,8 @@ import (
"context"
"time"

"github.com/pingcap/br/pkg/version"

Copy link
Contributor

Choose a reason for hiding this comment

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

Please optimize the imports.

@3pointer 3pointer added this to the v5.0.1 milestone May 11, 2021
@lonng lonng modified the milestones: v5.0.1, v5.0.2 May 19, 2021
Copy link
Contributor

@lichunzhu lichunzhu 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 the status/LGT1 LGTM1 label May 26, 2021
Copy link
Contributor

@lonng lonng 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
Copy link
Member Author

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lichunzhu
  • lonng

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@lonng
Copy link
Contributor

lonng commented May 26, 2021

/merge

@ti-chi-bot
Copy link
Member Author

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

Commit hash: f6a1646

@ti-chi-bot ti-chi-bot merged commit 719285d into pingcap:release-5.0 May 26, 2021
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.

6 participants