br: fix flaky test TestGCServiceSafePoint (#58628)

close pingcap/tidb#58627
This commit is contained in:
Wenqi Mou
2025-04-09 21:55:15 -04:00
committed by GitHub
parent 671534a755
commit a2392005b8
2 changed files with 6 additions and 3 deletions

View File

@ -127,6 +127,9 @@ func newCheckpointWithSpan(s spans.Valued) *checkpoint {
}
func (c *checkpoint) safeTS() uint64 {
if c.TS == 0 {
return 0
}
return c.TS - 1
}
@ -429,7 +432,7 @@ func (c *CheckpointAdvancer) onTaskEvent(ctx context.Context, e TaskEvent) error
}
log.Info("get global checkpoint", zap.Uint64("checkpoint", globalCheckpointTs))
c.lastCheckpoint = newCheckpointWithTS(globalCheckpointTs)
p, err := c.env.BlockGCUntil(ctx, globalCheckpointTs-1)
p, err := c.env.BlockGCUntil(ctx, c.lastCheckpoint.safeTS())
if err != nil {
log.Warn("failed to upload service GC safepoint, skipping.", logutil.ShortError(err))
}

View File

@ -677,7 +677,7 @@ func newTestEnv(c *fakeCluster, t *testing.T) *testEnv {
Name: "whole",
Info: &backup.StreamBackupTaskInfo{
Name: "whole",
StartTs: 5,
StartTs: 0,
},
Ranges: rngs,
}
@ -782,7 +782,7 @@ func (t *testEnv) putTask() {
Name: "whole",
Info: &backup.StreamBackupTaskInfo{
Name: "whole",
StartTs: 5,
StartTs: 0,
},
Ranges: rngs,
}