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

Fix corrupt registry occurring on power failure #6792

Closed
urso opened this issue Apr 6, 2018 · 0 comments
Closed

Fix corrupt registry occurring on power failure #6792

urso opened this issue Apr 6, 2018 · 0 comments

Comments

@urso
Copy link

urso commented Apr 6, 2018

This PR fixes a problem with the winlogbeat registry on windows: #2434

Both winglogbeat and filebeat write registry files, by first creating a new file and then replacing the old file using move(Rename).

In winlogbeat it is solved by enabling direct write through when writing the registry file (O_DIRECT + O_SYNC?).

The main issue is, a Close operation on a file does not necessarily imply the file is flushed to disk in full. This is no windows only issue. Instead of relying on direct write through, a better sequence for filebeat/winlogbeat registry updates would be: create tmp file -> serialize registry -> fsync tmp file -> close tmp file -> move tmp file into correct location -> run fsync on new parent directory.

Filebeat already uses O_SYNC, but I'm not sure about the current state of O_SYNC on Linux. In the past it has been known O_SYNC actually behaving like O_DSYNC (wonder if this is solved by now).

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

No branches or pull requests

1 participant