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 empty registry file on machine crash #3668

Merged
merged 1 commit into from
Feb 27, 2017

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented Feb 24, 2017

Closes #3537

@ruflin ruflin added discuss Issue needs further discussion. Filebeat Filebeat in progress Pull request is currently in progress. review Winlogbeat labels Feb 24, 2017
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
Copy link
Member Author

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.

Copy link
Member

@andrewkroh andrewkroh Feb 24, 2017

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).

Copy link
Member

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.

Copy link
Member

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

@ruflin ruflin added bug needs_backport PR is waiting to be backported to other branches. labels Feb 24, 2017
@ruflin
Copy link
Member Author

ruflin commented Feb 27, 2017

I removed FILE_FLAG_NO_BUFFERING again. As I plan to backport this PR to older branches, I keep the changes to a minimum and will to the moving to libbeat in a later PR.

@ruflin ruflin removed discuss Issue needs further discussion. in progress Pull request is currently in progress. labels Feb 27, 2017
@andrewkroh andrewkroh merged commit e2e58c0 into elastic:master Feb 27, 2017
@ruflin ruflin deleted the fix-registry-osync branch February 27, 2017 16:36
ruflin added a commit to ruflin/beats that referenced this pull request Feb 28, 2017
tsg pushed a commit that referenced this pull request Feb 28, 2017
@tsg tsg removed the needs_backport PR is waiting to be backported to other branches. label Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants