Skip to content

upgrademanager: clarify job running code#92620

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:upgrades.job-run
Dec 2, 2022
Merged

upgrademanager: clarify job running code#92620
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:upgrades.job-run

Conversation

@andreimatei
Copy link
Copy Markdown
Contributor

This patch makes the code clearer around running upgrade in jobs. Before this patch, the upgrade manager was looking for existing jobs corresponding to upgrades and, if it found them, it called jobsRegistry.Run() on them - just like it did for newly-created jobs. The behavior of Run() for jobs that are not already claimed by the registry is a bit under-specified. I believe it ended up printing an error [1] and then correctly waiting for the job to finish.

This patch no longer calls Run() for existing jobs; instead, it calls WaitForJobs(), which is more suggestive.

[1]

return errors.Errorf("job %d: claim with session id %s does not exist", jobID, s.ID())

Release note: None
Epic: None

@andreimatei andreimatei requested review from a team and ajwerner November 28, 2022 21:10
@andreimatei andreimatei requested a review from a team as a code owner November 28, 2022 21:10
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei)

This patch makes the code clearer around running upgrade in jobs. Before
this patch, the upgrade manager was looking for existing jobs
corresponding to upgrades and, if it found them, it called
jobsRegistry.Run() on them - just like it did for newly-created jobs.
The behavior of Run() for jobs that are not already claimed by the
registry is a bit under-specified. I believe it ended up printing an
error [1] and then correctly waiting for the job to finish.

This patch no longer calls Run() for existing jobs; instead, it calls
WaitForJobs(), which is more suggestive.

[1] https://github.com/cockroachdb/cockroach/blob/b2a6b80920324bd6b31cba9a6f622961979de600/pkg/jobs/adopt.go#L255

Release note: None
Epic: None
Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ajwerner)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 2, 2022

Build succeeded:

@craig craig bot merged commit f7f24fb into cockroachdb:master Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants