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

PBM-1329 Write to temporary file name and sync before renaming #954

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

DanielOliverRJ
Copy link

Whilst trying to understand historic cases where we have seen BSON deserialisation errors, I realised it was possible for filesystem writes to be incomplete, but be unable to determine the fact. In particular, once an oplog file exists on the filesystem, it is assumed to be complete even though the write may have been interrupted.

This change performs all filesystem writes to a temporary file in the same directory and does a rename once the sync has returned.

In the event of a failure, calling Close() on the same file handle does not cause an error because the deferred call discards the error.

I do not believe non-filesystem storage are affected by this problem, as the providers have other checks in place to ensure the upload completed.

@it-percona-cla
Copy link

it-percona-cla commented Jun 25, 2024

CLA assistant check
All committers have signed the CLA.

@defbin
Copy link
Member

defbin commented Jun 27, 2024

hi @DanielOliverRJ. thank you for your contributions. Could you please try to review/sign the CLA again so we can proceed?

@DanielOliverRJ
Copy link
Author

Sorry, I had to get the CLA text approved before I could sign. This is now completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants