Skip to content

Commit

Permalink
Merge pull request #89072 from knz/backport22.2-89064
Browse files Browse the repository at this point in the history
  • Loading branch information
knz authored Oct 3, 2022
2 parents 9ad0853 + 4a7155b commit e479f42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/jobs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ go_library(

go_test(
name = "jobs_test",
size = "medium",
size = "large",
srcs = [
"delegate_control_test.go",
"executor_impl_test.go",
Expand All @@ -93,7 +93,7 @@ go_test(
"scheduled_job_test.go",
"testutils_test.go",
],
args = ["-test.timeout=295s"],
args = ["-test.timeout=895s"],
embed = [":jobs"],
shard_count = 16,
deps = [
Expand Down
9 changes: 6 additions & 3 deletions pkg/jobs/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,15 +960,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 Expand Up @@ -1419,7 +1422,7 @@ func (r *Registry) MarkIdle(job *Job, isIdle bool) {
jobType := payload.Type()
jm := r.metrics.JobMetrics[jobType]
if aj.isIdle != isIdle {
log.Infof(r.serverCtx, "%s job %d: toggling idleness to %+v", jobType, job.ID(), isIdle)
log.VEventf(r.serverCtx, 2, "%s job %d: toggling idleness to %+v", jobType, job.ID(), isIdle)
if isIdle {
r.metrics.RunningNonIdleJobs.Dec(1)
jm.CurrentlyIdle.Inc(1)
Expand Down

0 comments on commit e479f42

Please sign in to comment.