Skip to content

sync_all() on leaf_set and prune_list#3354

Merged
antiochp merged 1 commit into
mimblewimble:masterfrom
antiochp:leaf_set_sync_all
Aug 19, 2020
Merged

sync_all() on leaf_set and prune_list#3354
antiochp merged 1 commit into
mimblewimble:masterfrom
antiochp:leaf_set_sync_all

Conversation

@antiochp
Copy link
Copy Markdown
Member

@antiochp antiochp commented Jun 12, 2020

4.0.0 has a dedicated branch now. Opening this up against master.


We should call sync_all() (aka fsync) when writing the leaf_set (and prune_list) with save_via_temp_file.

Renaming a file without first calling fsync is not safe.
See https://stackoverflow.com/questions/7433057/is-rename-without-fsync-safe

Also avoid removing the original file before renaming the temp file as this kind of defeats the atomicity of the "temp file and rename" approach.

Related #3352 (fsync rabbit hole).

@antiochp antiochp changed the title sync_all() on leaf_set and prune_list when using temp file [DNM] sync_all() on leaf_set and prune_list when using temp file Jun 12, 2020
@antiochp antiochp changed the title [DNM] sync_all() on leaf_set and prune_list when using temp file [DNM] sync_all() on leaf_set and prune_list Jun 27, 2020
@antiochp antiochp changed the title [DNM] sync_all() on leaf_set and prune_list sync_all() on leaf_set and prune_list Jul 8, 2020
@antiochp antiochp marked this pull request as ready for review July 8, 2020 08:07
Copy link
Copy Markdown
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

👍 makes sense didn't know about all that fsync stuff. Good to know. LGTM

@antiochp
Copy link
Copy Markdown
Member Author

@quentinlesceller thanks for taking a look. I have not touched this branch for a bit so I'm going to pick it up again and do some more testing before merging.

@antiochp antiochp merged commit 78e3ec3 into mimblewimble:master Aug 19, 2020
@antiochp antiochp deleted the leaf_set_sync_all branch August 19, 2020 08:37
@antiochp antiochp mentioned this pull request Sep 16, 2020
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.

2 participants