Skip to content

rowexec: fix TestUncertaintyErrorIsReturned under race#108328

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
yuzefovich:rowexec
Aug 8, 2023
Merged

rowexec: fix TestUncertaintyErrorIsReturned under race#108328
craig[bot] merged 2 commits intocockroachdb:masterfrom
yuzefovich:rowexec

Conversation

@yuzefovich
Copy link
Copy Markdown
Member

We just saw a case when TestUncertaintyErrorIsReturned failed under race because we got a different DistSQL plan. This seems plausible in case the range cache population (which the test does explicitly) isn't quick enough for some reason, so this commit allows for the DistSQL plan to match the expectation via SucceedsSoon (if we happen to get a bad plan, then the following query execution should have the up-to-date range cache).

Fixes: #108250.

Release note: None

We just saw a case when `TestUncertaintyErrorIsReturned` failed under
race because we got a different DistSQL plan. This seems plausible in
case the range cache population (which the test does explicitly) isn't
quick enough for some reason, so this commit allows for the DistSQL plan
to match the expectation via `SucceedsSoon` (if we happen to get a bad
plan, then the following query execution should have the up-to-date
range cache).

Release note: None
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@yuzefovich yuzefovich added the backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only label Aug 7, 2023
@yuzefovich yuzefovich marked this pull request as ready for review August 7, 2023 21:38
@yuzefovich yuzefovich requested a review from a team as a code owner August 7, 2023 21:38
@yuzefovich yuzefovich requested review from DrewKimball and msirek and removed request for msirek August 7, 2023 21:38
Copy link
Copy Markdown
Contributor

@mgartner mgartner 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 18 of 18 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball and @yuzefovich)


pkg/sql/rowexec/processors_test.go line 761 at r2 (raw file):

					// time in case the range cache wasn't populated as we
					// expected (we've seen this under race in #108250).
					testutils.SucceedsSoon(t, func() error {

Is there anyway to force an update to the range cache before making this query? I'm of the opinion that retries in tests are generally a bad thing because they make tests slower and tests that use them can still flake. I know we use retries everywhere, and we don't have to stop using them with this PR, but I'd love to see us using less and less retries in tests over the long-term.

Copy link
Copy Markdown
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r+

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


pkg/sql/rowexec/processors_test.go line 761 at r2 (raw file):

Previously, mgartner (Marcus Gartner) wrote…

Is there anyway to force an update to the range cache before making this query? I'm of the opinion that retries in tests are generally a bad thing because they make tests slower and tests that use them can still flake. I know we use retries everywhere, and we don't have to stop using them with this PR, but I'd love to see us using less and less retries in tests over the long-term.

I don't think there is an explicit way directly on the rangecache.RangeCache object to do that, but the test already uses the implicit way (performing SELECT query) in populateRangeCacheAndDisableBuffering. I'm not sure why it's insufficient, perhaps the implicit way is too slow under race. I agree that we should be conscious about putting retries in place, but it seems to me that here it's reasonable.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 8, 2023

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

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 8, 2023

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 8, 2023

Build succeeded:

@craig craig bot merged commit 69bc4c6 into cockroachdb:master Aug 8, 2023
@yuzefovich yuzefovich deleted the rowexec branch August 8, 2023 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql/rowexec: TestUncertaintyErrorIsReturned failed

3 participants