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

br: fix Log Backup unexpected paused when adding a already long-running task (#53695) #53945

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
2 changes: 1 addition & 1 deletion br/pkg/streamhelper/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ go_test(
],
flaky = True,
race = "on",
shard_count = 28,
shard_count = 32,
deps = [
":streamhelper",
"//br/pkg/errors",
Expand Down
13 changes: 11 additions & 2 deletions br/pkg/streamhelper/advancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,17 @@ func (c *CheckpointAdvancer) onTaskEvent(ctx context.Context, e TaskEvent) error
c.task = e.Info
c.taskRange = spans.Collapse(len(e.Ranges), func(i int) kv.KeyRange { return e.Ranges[i] })
c.setCheckpoints(spans.Sorted(spans.NewFullWith(e.Ranges, 0)))
c.lastCheckpoint = newCheckpointWithTS(e.Info.StartTs)
p, err := c.env.BlockGCUntil(ctx, c.task.StartTs)
globalCheckpointTs, err := c.env.GetGlobalCheckpointForTask(ctx, e.Name)
if err != nil {
log.Error("failed to get global checkpoint, skipping.", logutil.ShortError(err))
return err
}
if globalCheckpointTs < c.task.StartTs {
globalCheckpointTs = c.task.StartTs
}
log.Info("get global checkpoint", zap.Uint64("checkpoint", globalCheckpointTs))
c.lastCheckpoint = newCheckpointWithTS(globalCheckpointTs)
p, err := c.env.BlockGCUntil(ctx, globalCheckpointTs)
if err != nil {
log.Warn("failed to upload service GC safepoint, skipping.", logutil.ShortError(err))
}
Expand Down
2 changes: 2 additions & 0 deletions br/pkg/streamhelper/advancer_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ type StreamMeta interface {
Begin(ctx context.Context, ch chan<- TaskEvent) error
// UploadV3GlobalCheckpointForTask uploads the global checkpoint to the meta store.
UploadV3GlobalCheckpointForTask(ctx context.Context, taskName string, checkpoint uint64) error
// GetGlobalCheckpointForTask gets the global checkpoint from the meta store.
GetGlobalCheckpointForTask(ctx context.Context, taskName string) (uint64, error)
// ClearV3GlobalCheckpointForTask clears the global checkpoint to the meta store.
ClearV3GlobalCheckpointForTask(ctx context.Context, taskName string) error
PauseTask(ctx context.Context, taskName string) error
Expand Down
Loading
Loading