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

jobs: don't check the number of deleted rows #65394

Merged
merged 1 commit into from
May 18, 2021
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
7 changes: 2 additions & 5 deletions pkg/jobs/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,18 +933,15 @@ func (r *Registry) cleanupOldJobsPage(

log.VEventf(ctx, 2, "read potentially expired jobs: %d", numRows)
if len(toDelete.Array) > 0 {
log.Infof(ctx, "cleaning up expired job records: %d", len(toDelete.Array))
log.Infof(ctx, "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 {
return false, 0, errors.Wrap(err, "deleting old jobs")
}
if nDeleted != len(toDelete.Array) {
return false, 0, errors.AssertionFailedf("asked to delete %d rows but %d were actually deleted",
len(toDelete.Array), nDeleted)
}
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