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

backfill: fix possible race in tests #106224

Merged
merged 1 commit into from
Jul 10, 2023
Merged

Conversation

yuzefovich
Copy link
Member

This commit addresses a race when Pushing into execinfra.RowReceiver which can happen in tests. In particular, when
PushesProgressEveryChunk testing knob is set, there is a concurrency between the main waiter goroutine and worker goroutine, so we now add a mutex around that Push. In theory, RowReceiver.Push claims to be thread-safe, so it shouldn't be necessary, but two implementations (DistSQLReceiver and copyingRowReceiver) are actually not thread-safe, and fixing that is left as a TODO.

Fixes: #106161.

Release note: None

This commit addresses a race when `Push`ing into `execinfra.RowReceiver`
which can happen in tests. In particular, when
`PushesProgressEveryChunk` testing knob is set, there is a concurrency
between the main waiter goroutine and worker goroutine, so we now add
a mutex around that `Push`. In theory, `RowReceiver.Push` claims to be
thread-safe, so it shouldn't be necessary, but two implementations
(`DistSQLReceiver` and `copyingRowReceiver`) are actually not
thread-safe, and fixing that is left as a TODO.

Release note: None
@yuzefovich yuzefovich added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jul 5, 2023
@yuzefovich yuzefovich requested a review from cucaroach July 5, 2023 22:19
@yuzefovich yuzefovich requested a review from a team as a code owner July 5, 2023 22:19
@blathers-crl
Copy link

blathers-crl bot commented Jul 5, 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

@yuzefovich
Copy link
Member Author

@cockroachdb/sql-queries could someone take a look since Tommy is out? It's a very small change.

Copy link
Collaborator

@michae2 michae2 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 @cucaroach)

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 10, 2023

Build succeeded:

@craig craig bot merged commit 3ca7382 into cockroachdb:master Jul 10, 2023
@yuzefovich yuzefovich deleted the backfill-race branch July 10, 2023 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: TestIndexBackfillFractionTracking failed, data race
3 participants