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

sstable: fix error path in writer.Close #2380

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented Mar 5, 2023

Close() records any error encountered and exits early if called again. One of the return paths was not setting w.err, possibly causing the panic in github.com/cockroachdb/cockroach/issues/97350.

This change fixes this and improves the structure of the function - instead of each exit path having to set w.err, we set it in the deferred function.

@RaduBerinde RaduBerinde requested review from jbowens and a team March 5, 2023 17:53
@cockroach-teamcity
Copy link
Member

This change is Reviewable

`Close()` records any error encountered and exits early if called
again. One of the return paths was not setting `w.err`, possibly
causing the panic in github.com/cockroachdb/cockroach/issues/97350.

This change fixes this and improves the structure of the function -
instead of each exit path having to set `w.err`, we set it in the
deferred function.
@RaduBerinde RaduBerinde force-pushed the sstwriter-double-close branch from 02d0a70 to bb5f55b Compare March 5, 2023 17:54
Copy link
Collaborator

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

Nice

:lgtm:

Reviewed all commit messages.
Reviewable status: 0 of 1 files reviewed, all discussions resolved

@RaduBerinde
Copy link
Member Author

TFTR!

@RaduBerinde RaduBerinde merged commit e9a8c4a into cockroachdb:master Mar 6, 2023
@RaduBerinde RaduBerinde deleted the sstwriter-double-close branch April 18, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants