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

backupccl: always track opened writer #104187

Merged
merged 1 commit into from
Jun 1, 2023
Merged

Conversation

dt
Copy link
Member

@dt dt commented Jun 1, 2023

Previously we would do things -- like wrap the opened writer with an encryption shim -- after opening the writer but before storing it in the sink. This could mean that if the sink opened a writer, but failed to save it, and was then closed it would fail to close the writer. This changes that, so that as soon as the writer is opened it is saved and then if it is later wrapped, saved again, to ensure that we cannot lose track of any successfully opened writer.

Fixes: #103597.

Release note: none.

Previously we would do things -- like wrap the opened writer with an encryption shim --
after opening the writer but before storing it in the sink. This could mean that if the
sink opened a writer, but failed to save it, and was then closed it would fail to close
the writer. This changes that, so that as soon as the writer is opened it is saved and
then if it is later wrapped, saved again, to ensure that we cannot lose track of any
successfully opened writer.

Fixes: cockroachdb#103597.

Release note: none.
@dt dt requested review from benbardin and renatolabs June 1, 2023 12:00
@dt dt requested a review from a team as a code owner June 1, 2023 12:00
@blathers-crl
Copy link

blathers-crl bot commented Jun 1, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@dt dt removed the request for review from benbardin June 1, 2023 12:00
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Funzies.

I do wonder if we could write a unit test for this case, but I won't block on that since we have a failing test that this is fixing.

@dt
Copy link
Member Author

dt commented Jun 1, 2023

One tricky thing about a unit test is that crash only happens when using google cloud storage, which by default we'd never do during unit tests.

I thought about adding my mutex-wrapped-map of open writers that I used to debug this to nodelocal or userfile so they could synthesize the same crash but not sure it is worth it?

In any case, merging the fix now to unblock @renatolabs and will keep pondering if there is a better unit test.

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 1, 2023

Build succeeded:

@craig craig bot merged commit 6088d66 into cockroachdb:master Jun 1, 2023
@dt dt deleted the close-err branch June 1, 2023 20:05
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.

backupccl: nil pointer crash in storage.(*Writer).open during backup in 22.2.9
3 participants