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

storage: mvccExportToWriter should always return buffered range keys #98289

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

stevendanna
Copy link
Collaborator

In #96691, we changed the return type of mvccExportToWriter such that it now indicates when a CPU limit has been reached. As part of that change, when the CPU limit was reached, we would immedately return rather than breaking out of the loop. This introduced a bug, since the code after the loop that the break was taking us to is important. Namely, we may have previously buffered range keys that we need to write into our response still. By replacing the break with a return, these range keys were lost.

The end-user impact of this is that a BACKUP that ought to have included range keys (such as a backup of a table with a rolled back IMPORT) would not include those range keys and thus would end up resurecting deleted keys upon restore.

This PR brings back the break and adds a test that covers exporting with range keys under CPU exhaustion.

This bug only ever existed on master.

Informs #97694

Epic: none

Release note: None

In cockroachdb#96691, we changed the return type of mvccExportToWriter such that
it now indicates when a CPU limit has been reached. As part of that
change, when the CPU limit was reached, we would immedately `return`
rather than `break`ing out of the loop. This introduced a bug, since
the code after the loop that the `break` was taking us to is
important. Namely, we may have previously buffered range keys that we
need to write into our response still. By replacing the break with a
return, these range keys were lost.

The end-user impact of this is that a BACKUP that _ought_ to have
included range keys (such as a backup of a table with a rolled back
IMPORT) would not include those range keys and thus would end up
resurecting deleted keys upon restore.

This PR brings back the `break` and adds a test that covers exporting
with range keys under CPU exhaustion.

This bug only ever existed on master.

Informs cockroachdb#97694

Epic: none

Release note: None
@stevendanna stevendanna requested a review from a team as a code owner March 9, 2023 11:18
@stevendanna stevendanna requested a review from bananabrick March 9, 2023 11:18
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@stevendanna stevendanna changed the title storage: mvccExportToWriter should return always buffered range keys storage: mvccExportToWriter should always return buffered range keys Mar 9, 2023
Copy link
Contributor

@adityamaru adityamaru left a comment

Choose a reason for hiding this comment

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

Thank you (again)!

@stevendanna
Copy link
Collaborator Author

bors r=adityamaru

@craig
Copy link
Contributor

craig bot commented Mar 9, 2023

Build succeeded:

@craig craig bot merged commit 62eb4b8 into cockroachdb:master Mar 9, 2023
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