Skip to content

storage: close pebble iter gracefully when NewPebbleSSTIterator fails#84003

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
msbutler:butler-newPebbleIterator-close
Jul 7, 2022
Merged

storage: close pebble iter gracefully when NewPebbleSSTIterator fails#84003
craig[bot] merged 1 commit intocockroachdb:masterfrom
msbutler:butler-newPebbleIterator-close

Conversation

@msbutler
Copy link
Copy Markdown
Collaborator

@msbutler msbutler commented Jul 7, 2022

Currently, if pebble.NewExternalIter sets pebbleIterator.inuse to True, but
then fails, the subsequent pebbleIterator.destroy() will panic unecessarily,
since the caller of pebble.NewExternalIter is not actually using the iter.
This bug causes TestBackupRestoreChecksum to flake in #83984.

To fix, this patch uses pebble.Close() to gracefully close the pebbleIterator
if pebble.NewExternalIter fails.

Release Note: None

Currently, if `pebble.NewExternalIter` sets pebbleIterator.inuse to True, but
then fails, the subsequent `pebbleIterator.destroy()` will panic unecessarily,
since the caller of `pebble.NewExternalIter` is not actually using the iter.
This bug causes TestBackupRestoreChecksum to flake in cockroachdb#83984.

To fix, this patch uses pebble.Close() to  gracefully close the pebbleIterator
if `pebble.NewExternalIter` fails.

Release Note: None
@msbutler msbutler requested a review from erikgrinaker July 7, 2022 14:59
@msbutler msbutler requested a review from a team as a code owner July 7, 2022 14:59
@msbutler msbutler self-assigned this Jul 7, 2022
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

Oops, thanks for fixing!

@msbutler
Copy link
Copy Markdown
Collaborator Author

msbutler commented Jul 7, 2022

bors r=erikgrinaker

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 7, 2022

Build succeeded:

@craig craig bot merged commit 2dd8e76 into cockroachdb:master Jul 7, 2022
@msbutler msbutler deleted the butler-newPebbleIterator-close branch July 7, 2022 23:51
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