-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Write Promtail position file atomically. #5266
Write Promtail position file atomically. #5266
Conversation
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.
Nice! Added a question about Windows but overall LGTM
|
||
err = ioutil.WriteFile(temp, buf, os.FileMode(positionFileMode)) | ||
err = renameio.WriteFile(target, buf, os.FileMode(positionFileMode)) |
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.
https://github.com/google/renameio#windows-support
According to this, we should probably special-case Windows here. What do you think?
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.
I wanted to reference it. You were faster. I think so. We should use the old version on Windows.
|
||
err = ioutil.WriteFile(temp, buf, os.FileMode(positionFileMode)) | ||
err = renameio.WriteFile(target, buf, os.FileMode(positionFileMode)) |
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.
I wanted to reference it. You were faster. I think so. We should use the old version on Windows.
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.
Minor suggestion, but otherwise LGTM!
What this PR does / why we need it:
This uses
renameio
that supports writing files atomically.Which issue(s) this PR fixes:
Fixes #5218
Special notes for your reviewer:
Checklist
CHANGELOG.md
about the changes.