jobs: configure more frequent retries for polling in Registry.Run() #45677
jobs: configure more frequent retries for polling in Registry.Run() #45677craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
3f1293d to
0662000
Compare
ajwerner
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r1.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @lucy-zhang and @spaskob)
pkg/jobs/registry.go, line 275 at r1 (raw file):
// WHEN COMPLETE, if one of the jobs is missing from the jobs table for // whatever reason, we'll fail later when we try to load the job. rows, err := ex.QueryRowEx(
nit: it's a single row, call it row?
pkg/jobs/registry.go, line 280 at r1 (raw file):
nil, /* txn */ sqlbase.InternalExecutorSessionDataOverride{User: security.RootUser}, fmt.Sprintf("SELECT count(*) FROM [SHOW JOBS VALUES %s] WHERE finished IS NULL", buf.String()),
nit: can you format the query above the loop?
spaskob
left a comment
There was a problem hiding this comment.
LGTM
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @lucy-zhang and @spaskob)
spaskob
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 2 of 0 LGTMs obtained (waiting on @lucy-zhang and @spaskob)
Previously, we were using `SHOW JOBS WHEN COMPLETE` to wait for queued jobs to finish, which uses a constant retry interval (on the server side) of 1s. This will be too long for short schema change jobs that require much less than 1s to complete. This PR replaces the use of `SHOW JOBS WHEN COMPLETE` with a retry loop that starts with a 10ms backoff and increases to a maximum of 1s in `Registry.Run()`. We currently have no jobs using the queuing interface, so there's no user-facing change. Release note: None
0662000 to
b83e9c8
Compare
thoszhang
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 2 stale) (waiting on @ajwerner)
pkg/jobs/registry.go, line 275 at r1 (raw file):
Previously, ajwerner wrote…
nit: it's a single row, call it
row?
done
pkg/jobs/registry.go, line 280 at r1 (raw file):
Previously, ajwerner wrote…
nit: can you format the query above the loop?
done
|
TFTRs bors r+ |
Build succeeded |
Previously, we were using
SHOW JOBS WHEN COMPLETEto wait for queuedjobs to finish, which uses a constant retry interval (on the server
side) of 1s. This will be too long for short schema change jobs that
require much less than 1s to complete. This PR replaces the use of
SHOW JOBS WHEN COMPLETEwith a retry loop that starts with a 10ms backoffand increases to a maximum of 1s in
Registry.Run().We currently have no jobs using the queuing interface, so there's no
user-facing change.
Release note: None