Skip to content
Merged
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
17 changes: 10 additions & 7 deletions pkg/vm/engine/tae/db/cronjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,23 +176,26 @@ func AddCronJob(db *DB, name string, skipMode bool) (err error) {
if db.Opts.CatalogCfg.DisableGC {
return
}
scanWaterMark := db.DiskCleaner.GetCleaner().GetScanWaterMark()
if scanWaterMark == nil {
ckp := db.BGCheckpointRunner.MaxIncrementalCheckpoint()
if ckp == nil {
return
}
wartMark := ckp.GetEnd()
if wartMark.IsEmpty() {
return
}
ts := scanWaterMark.GetEnd()
// If gcWaterMark has not been updated for a long time
// exceeding GlobalVersionInterval, use GlobalVersionInterval
// must be more than 10 minutes to be effective,
// because in some cases of ut, GlobalVersionInterval will be very short
if db.Opts.CheckpointCfg.GlobalVersionInterval > 10*time.Minute {
interval := types.BuildTS(time.Now().UTC().UnixNano()-
ts := types.BuildTS(wartMark.Physical()-
int64(db.Opts.CheckpointCfg.GlobalVersionInterval), 0)
if ts.LE(&interval) {
ts = interval
if wartMark.GE(&ts) {
wartMark = ts
}
}
db.Catalog.GCByTS(ctx, ts)
db.Catalog.GCByTS(ctx, wartMark)
},
1,
)
Expand Down
Loading