Filesystem storage writes should write, fsync and rename
General
Escalation
General
Escalation
Description
Trying to work out why we’ve seen corruption in backups, I realised it’s possible that the filesystem Save() function writes directly to the final file name. For files such as incremental oplogs, it’s possible these writes could be interrupted (particularly if to CIFS/NFS) and there would be no way to tell from the filesystem.
It would be safer to do writes to a temporary file name, fsync, and then rename the file to the final name.
Environment
None
Activity
Aaditya Dubey
June 7, 2024 at 12:16 PM
Hi @Daniel Oliver
Thank you for the report. It doesn't look like a bug; instead, we considered it an improvement.
Trying to work out why we’ve seen corruption in backups, I realised it’s possible that the filesystem Save() function writes directly to the final file name. For files such as incremental oplogs, it’s possible these writes could be interrupted (particularly if to CIFS/NFS) and there would be no way to tell from the filesystem.
It would be safer to do writes to a temporary file name, fsync, and then rename the file to the final name.