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

Fix possible data race when committing block files #14501

Open
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
6 participants
@luke-jr
Copy link
Member

luke-jr commented Oct 17, 2018

Reviving #12696

util: Refactor FileCommit from an #if sequence nested in #else, to a …
…sequence of #elif

This should not change the actual code generation.

@luke-jr luke-jr force-pushed the luke-jr:fsync_dir branch from 246c7b0 to 56483d1 Oct 17, 2018

@@ -1019,16 +1019,16 @@ bool FileCommit(FILE *file)
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
return false;
}
#if defined(MAC_OSX) && defined(F_FULLFSYNC)

This comment has been minimized.

@ken2812221

ken2812221 Oct 17, 2018

Member

It's impossible to both define WIN32 and MAC_OSX at the same time. Should be elif

This comment has been minimized.

@luke-jr

luke-jr Oct 17, 2018

Member

This was meant to be an #elif, fixed.

eklitzke and others added some commits Mar 15, 2018

Fix possible data race when committing block files
It was recently pointed out to me that calling fsync() or fdatasync() on a new
file is not sufficient to ensure it's persisted to disk, a the existence of the
file itself is stored in the directory inode. This means that ensuring that a
new file is actually committed also requires an fsync() on the parent directory.

This change ensures that we call fsync() on the blocks directory after
committing new block files.
util: Prefer Mac-specific F_FULLSYNC over fdatasync in FileCommit
Since fdatasync currently checks for __linux__ or __NetBSD__, this has no effect on code generation.
(However, the next commit changes that...)

@luke-jr luke-jr force-pushed the luke-jr:fsync_dir branch from 56483d1 to 62fb7bb Oct 17, 2018

@DrahtBot

This comment has been minimized.

Copy link
Contributor

DrahtBot commented Nov 5, 2018

Needs rebase
@luke-jr

This comment has been minimized.

Copy link
Member

luke-jr commented Nov 22, 2018

(GitHub and DrahtBot are misdetecting a rebase needed here; it is a clean merge still... can't at least DrahtBot get fixed??)

@ken2812221

This comment has been minimized.

Copy link
Member

ken2812221 commented Nov 22, 2018

You have to move src/util.cpp to src/util/system.cpp?

@luke-jr

This comment has been minimized.

Copy link
Member

luke-jr commented Nov 22, 2018

git follows the move just fine.

@MarcoFalke

This comment has been minimized.

Copy link
Member

MarcoFalke commented Nov 22, 2018

@luke-jr There are different merge strategies and flags (https://git-scm.com/docs/git-merge#git-merge-mergetool) and GitHub uses a rather strict one, which they were unable to disclose to me.

It appear that this pull request hasn't had any review yet, so doing a rebase comes at no cost at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment