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

sql: fix small race in distIndexBackfiller #75857

Merged
merged 2 commits into from
Feb 2, 2022

Conversation

stevendanna
Copy link
Collaborator

This fixes a small race condition in
distIndexBackfiller. updateJobDetails calls SetResumeSpansInJob which
mutates the ResumeSpanList in the job details. Normally, this is only
called from the periodic updater. However, when the testing knob
AlwasyUpdateIndexBackfillDetails is set, we also update it on every
ProducerMetadata message we get back

Release note: None

This fixes a small race condition in
distIndexBackfiller. updateJobDetails calls SetResumeSpansInJob which
mutates the ResumeSpanList in the job details.  Normally, this is only
called from the periodic updater.  However, when the testing knob
AlwasyUpdateIndexBackfillDetails is set, we also update it on every
ProducerMetadata message we get back

Release note: None
@stevendanna stevendanna requested a review from a team February 2, 2022 14:21
@cockroach-teamcity
Copy link
Member

This change is Reviewable

This is another small data race in distIndexBackfill. This code was
operating on mu.updatedTodoSpans (without holding the lock) instead of
the copy that we created a few lines above (while holding the lock).

Release note: None
@stevendanna
Copy link
Collaborator Author

stevendanna commented Feb 2, 2022

@adityamaru Apologies, I pushed another commit for another race that I found when iterating. Mind taking another look?

For the curious, these are only surfacing now because we happened to write a test that, for $reasons$ was using an incredibly low update interval.

@adityamaru
Copy link
Contributor

Ah nice catch again, LGTM!

@stevendanna
Copy link
Collaborator Author

bors r=adityamaru

@craig
Copy link
Contributor

craig bot commented Feb 2, 2022

Build succeeded:

@craig craig bot merged commit 88522a3 into cockroachdb:master Feb 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