-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 empty registry file on machine crash #3668
Conversation
syscall.CREATE_ALWAYS, // Create Mode | ||
uint32(syscall.FILE_ATTRIBUTE_NORMAL|_FILE_FLAG_WRITE_THROUGH), // Flags and Attributes | ||
syscall.CREATE_ALWAYS, // Create Mode | ||
uint32(syscall.FILE_ATTRIBUTE_NORMAL|_FILE_FLAG_WRITE_THROUGH|_FILE_FLAG_NO_BUFFERING), // Flags and Attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewkroh I tried to find O_SYNC for windows and it seems to be the NO_BUFFERING. Looking into filebeat, we do not treat creating the registry for different OS differently. Should we?
In any case, we should still unify registrar handling in libbeat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we should. We could move this file creation code up to libbeat so that we could share it. That would be simpler than trying to unify the registrar (which is still a good idea, but more time consuming).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand on Windows you need to use FILE_FLAG_WRITE_THROUGH
to get writes to bypass the cache. FILE_FLAG_NO_BUFFERING implies FILE_FLAG_WRITE_THROUGH too, but it affects reads and adds the requirement that your reads must be aligned to disk sector boundaries. So I don't think we need FILE_FLAG_NO_BUFFERING here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what originally pointed me to FILE_FLAG_WRITE_THROUGH. https://stackoverflow.com/questions/6525943/cause-of-corrupted-file-contents/24302389#24302389
I removed |
7ba38f5
to
f717a9e
Compare
Closes elastic#3537 (cherry picked from commit e2e58c0)
Closes #3537