Skip to content

Commit

Permalink
Merge pull request #89074 from knz/backport21.2-89064
Browse files Browse the repository at this point in the history
  • Loading branch information
knz authored Oct 4, 2022
2 parents ef8227d + 418ec8a commit f9647b7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/jobs/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,15 +987,18 @@ func (r *Registry) cleanupOldJobsPage(

log.VEventf(ctx, 2, "read potentially expired jobs: %d", numRows)
if len(toDelete.Array) > 0 {
log.Infof(ctx, "attempting to clean up %d expired job records", len(toDelete.Array))
log.VEventf(ctx, 2, "attempting to clean up %d expired job records", len(toDelete.Array))
const stmt = `DELETE FROM system.jobs WHERE id = ANY($1)`
var nDeleted int
if nDeleted, err = r.ex.Exec(
ctx, "gc-jobs", nil /* txn */, stmt, toDelete,
); err != nil {
log.Warningf(ctx, "error cleaning up %d jobs: %v", len(toDelete.Array), err)
return false, 0, errors.Wrap(err, "deleting old jobs")
}
log.Infof(ctx, "cleaned up %d expired job records", nDeleted)
if nDeleted > 0 {
log.Infof(ctx, "cleaned up %d expired job records", nDeleted)
}
}
// If we got as many rows as we asked for, there might be more.
morePages := numRows == pageSize
Expand Down

0 comments on commit f9647b7

Please sign in to comment.