Skip to content

sql: actually deflake TestSavepoints#73494

Merged
craig[bot] merged 2 commits intocockroachdb:masterfrom
nvb:nvanbenschoten/actuallyFixTestSavepoints
Dec 6, 2021
Merged

sql: actually deflake TestSavepoints#73494
craig[bot] merged 2 commits intocockroachdb:masterfrom
nvb:nvanbenschoten/actuallyFixTestSavepoints

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Dec 6, 2021

This PR rolls back #73388 and reworks the fix for #70220. #73388 was an incorrect fix because the test relies on the progress table being updated in the same transaction as the rest of the SQL logic. This ensures that progress updates are rolled back when the rest of the transaction is rolled back. I didn't catch this in the initial PR because I missed the fact that the test had been skipped on master, so the test appeared to be passing with the change. When I then tried to backport the change in #73492, CI caught the mistake.

The PR then deflakes TestSavepoints by increasing the lock timeout significantly (from 1ms to 100ms) in the rollback_after_lock_timeout subtest. The test was flaky because after the transaction hits a lock timeout error, it performs an async rollback. If this async rollback hasn't grabbed latches by the time the next txn retry (with a different txn ID) finishes waiting out the lock_timeout when attempting to write to its progress, a lock timeout error would be thrown. This commit makes this extremely unlikely by increasing the lock timeout from 1ms to 100ms. With this new timeout, I've never seen the test flake under stress.

nvb added 2 commits December 5, 2021 23:41
This commit deflakes `TestSavepoints` by increasing the lock timeout
significantly (from 1ms to 100ms) in the `rollback_after_lock_timeout`
subtest. The test was flaky because after the transaction hits a lock
timeout error, it performs an async rollback. If this async rollback
hasn't grabbed latches by the time the next txn retry (with a different
txn ID) finishes waiting out the lock_timeout when attempting to write
to its progress, a lock timeout error would be thrown. This commit makes
this extremely unlikely by increasing the lock timeout from 1ms to 100ms.
With this new timeout, I've never seen the test flake under stress.
@nvb nvb requested a review from andreimatei December 6, 2021 04:54
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@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.

:lgtm:

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

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Dec 6, 2021

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 6, 2021

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 6, 2021

Build succeeded:

@craig craig bot merged commit 69b29a5 into cockroachdb:master Dec 6, 2021
@nvb nvb deleted the nvanbenschoten/actuallyFixTestSavepoints branch December 7, 2021 02:57
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