Skip to content

Commit

Permalink
log-backup: PITR do not support batch if skip requirement check (#39770
Browse files Browse the repository at this point in the history
…) (#39777)

close #39722
  • Loading branch information
ti-chi-bot authored Dec 9, 2022
1 parent b1ff63e commit 8fa8740
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
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

0 comments on commit 8fa8740

Please sign in to comment.