Skip to content

Commit

Permalink
log-backup: get can restored global-checkpoint-ts when support v3 che…
Browse files Browse the repository at this point in the history
…ckpoint advance (#36197)

close #29501
  • Loading branch information
joccau authored Jul 13, 2022
1 parent 5eec739 commit 1885ebf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions br/pkg/task/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,11 @@ func getGlobalResolvedTS(
return 0, errors.Trace(err)
}
var globalCheckpointTS uint64 = 0
// TODO change the logic after checkpoint v3 implemented
// If V3 global-checkpoint advance, the maximum value in storeMap.resolvedTSMap as global-checkpoint-ts.
// If v2 global-checkpoint advance, it need the minimal value in storeMap.resolvedTSMap as global-checkpoint-ts.
// Because each of store maintains own checkpoint-ts only.
for _, resolveTS := range storeMap.resolvedTSMap {
if resolveTS < globalCheckpointTS || globalCheckpointTS == 0 {
if globalCheckpointTS < resolveTS {
globalCheckpointTS = resolveTS
}
}
Expand Down
4 changes: 2 additions & 2 deletions br/pkg/task/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func TestGetGlobalResolvedTS(t *testing.T) {
require.Nil(t, err)
globalResolvedTS, err := getGlobalResolvedTS(ctx, s)
require.Nil(t, err)
require.Equal(t, uint64(100), globalResolvedTS)
require.Equal(t, uint64(101), globalResolvedTS)
}

func TestGetGlobalResolvedTS2(t *testing.T) {
Expand Down Expand Up @@ -309,5 +309,5 @@ func TestGetGlobalResolvedTS2(t *testing.T) {
require.Nil(t, err)
globalResolvedTS, err := getGlobalResolvedTS(ctx, s)
require.Nil(t, err)
require.Equal(t, uint64(98), globalResolvedTS)
require.Equal(t, uint64(99), globalResolvedTS)
}

0 comments on commit 1885ebf

Please sign in to comment.