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

Use rename to write v2 store files atomically #86

Closed
jldec opened this issue Jun 1, 2024 — with Linear · 3 comments
Closed

Use rename to write v2 store files atomically #86

jldec opened this issue Jun 1, 2024 — with Linear · 3 comments

Comments

Copy link

jldec commented Jun 1, 2024

Context

If the store process exits during a write, files should not be left in a partially written state.

Proposal

First write to a temp file and then rename.

This is related to #80, since we need to keep watching the file after rename.

Copy link
Member

since we need to keep watching the file after rename.

In what scenario will a file be renamed?

I assume that the file name will be the (human) id of the message. By definition, the human id will never change

Copy link
Author

jldec commented Jun 3, 2024

Right, the filename known to git should not change.

The idea for this is to use a temp filename during the write, and then rename that to replace the versioned filename, when the file is fully persisted on disk. This (hopefully) makes the changes to the file atomic.

Copy link
Author

jldec commented Jun 6, 2024

LIX-83

@samuelstroschein samuelstroschein closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2024
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

No branches or pull requests

2 participants