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: avoid race conditions in tests #98458

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

knz
Copy link
Contributor

@knz knz commented Mar 12, 2023

Needed for #98440.
Epic: CRDB-23559

When investigating jobs created during cluster migrations I found that the unit tests in the jobs packages have a race condition with the registry, because they register new job types (adding new constructors) concurrently with job adoption occurring during startup (using constructors).

This patch fixes it.

Release note: None

@knz knz requested review from ajwerner and miretskiy March 12, 2023 16:41
@knz knz requested a review from a team as a code owner March 12, 2023 16:41
@blathers-crl
Copy link

blathers-crl bot commented Mar 12, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@knz
Copy link
Contributor Author

knz commented Mar 12, 2023

TFYR

bors r=miretskiy

@craig
Copy link
Contributor

craig bot commented Mar 12, 2023

Build failed:

@knz
Copy link
Contributor Author

knz commented Mar 12, 2023

bors r=miretskiy

@craig
Copy link
Contributor

craig bot commented Mar 12, 2023

Build failed:

@knz
Copy link
Contributor Author

knz commented Mar 12, 2023

bors r=miretskiy

craig bot pushed a commit that referenced this pull request Mar 12, 2023
98458: jobs: avoid race conditions in tests r=miretskiy a=knz

Needed for #98440.
Epic: CRDB-23559

When investigating jobs created during cluster migrations I found that the unit tests in the jobs packages have a race condition with the registry, because they register new job types (adding new constructors) concurrently with job adoption occurring during startup (using constructors).

This patch fixes it.

Release note: None

Co-authored-by: Raphael 'kena' Poss <[email protected]>
@craig
Copy link
Contributor

craig bot commented Mar 13, 2023

Build failed:

@knz
Copy link
Contributor Author

knz commented Mar 13, 2023

bors r=miretskiy

@craig
Copy link
Contributor

craig bot commented Mar 13, 2023

Build failed (retrying...):

@knz knz force-pushed the 20230312-knz-jobs-mutex branch from 545a9a3 to d9d858b Compare March 13, 2023 21:50
@craig
Copy link
Contributor

craig bot commented Mar 13, 2023

Canceled.

@knz
Copy link
Contributor Author

knz commented Mar 13, 2023

bors r=miretskiy

When investigating jobs created during cluster migrations I found that
the unit tests in the jobs package have a race condition with the
registry, because they register new job types (adding new
constructors) concurrently with job adoption occurring during
startup (using constructors).

This patch fixes it.

Release note: None
@knz knz force-pushed the 20230312-knz-jobs-mutex branch from d9d858b to e0cfcc1 Compare March 13, 2023 21:58
@craig
Copy link
Contributor

craig bot commented Mar 13, 2023

Canceled.

@knz
Copy link
Contributor Author

knz commented Mar 13, 2023

bors r=miretskiy

@craig
Copy link
Contributor

craig bot commented Mar 13, 2023

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Mar 13, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@craig craig bot merged commit e0cfcc1 into cockroachdb:master Mar 14, 2023
@knz knz deleted the 20230312-knz-jobs-mutex branch March 14, 2023 00:59
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