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: PITR do not support batch if skip requirement check (#39770) #39777

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions br/pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ var (

versionHash = regexp.MustCompile("-[0-9]+-g[0-9a-f]{7,}")

checkpointSupportError error = nil
pitrSupportBatchKVFiles bool = true
checkpointSupportError error = nil
// pitrSupportBatchKVFiles specifies whether TiKV-server supports batch PITR.
pitrSupportBatchKVFiles bool = false
)

// NextMajorVersion returns the next major version.
Expand Down Expand Up @@ -140,6 +141,8 @@ func CheckVersionForBRPiTR(s *metapb.Store, tikvVersion *semver.Version) error {
// If tikv version < 6.5, PITR do not support restoring batch kv files.
if tikvVersion.Major < 6 || (tikvVersion.Major == 6 && tikvVersion.Minor < 5) {
pitrSupportBatchKVFiles = false
} else {
pitrSupportBatchKVFiles = true
}

// The versions of BR and TiKV should be the same when use BR 6.1.0
Expand Down
9 changes: 9 additions & 0 deletions br/pkg/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ func TestCheckClusterVersion(t *testing.T) {
require.Regexp(t, `^TiKV .* version mismatch when use PiTR v6.2.0\+, please `, err.Error())
}

{
// Default value of `pitrSupportBatchKVFiles` should be `false`.
build.ReleaseVersion = "v6.5.0"
mock.getAllStores = func() []*metapb.Store {
return []*metapb.Store{{Version: `v6.2.0`}}
}
require.Equal(t, CheckPITRSupportBatchKVFiles(), false)
}

{
build.ReleaseVersion = "v6.2.0"
mock.getAllStores = func() []*metapb.Store {
Expand Down