-
Notifications
You must be signed in to change notification settings - Fork 101
Rollback Using Temp Files & Fix Atomic Writes #1302
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
base: main
Are you sure you want to change the base?
Conversation
What does this mean? We will write into the |
I can change it to fail just after discussing with Donal we were just trying to set it to a default in case something happened where it wouldn't be set. But in reality it will probably always bet set as it is sent with the config context. |
Fair, I'm more concerned with us writing the intermediary files into the |
) error | ||
SetIsConnected(isConnected bool) | ||
MoveFilesFromTempDirectory(ctx context.Context, fileAction *model.FileCache, tempDir string) error | ||
renameFile(ctx context.Context, hash, fileName, tempDir string) error |
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.
Think you can remove this from the interface?
Proposed changes
Changes:
Update Atomic writes to create the temp directory in the location of the NGINX config or a default of
"/etc/nginx"
if we can't get the config dir. Instead of the file being moved it is now renamed preserving the file permissions etcRollback has changed to before a config apply starts create a copy of the file to a temp directory (need to use copy here to not delete original) at the location of the NGINX config. If a rollback occurs these files are renamed to rollback the files
File watchers are now enabled by a specific topic sent after we have cleaned up the temp directories, File Watcher now when disabled removes all directories it is watching and then they are added back when it is enabled. This is to prevent an issue where the events that happened while the watcher was disabled were still on the channel when the watcher was enabled causing agent to process those events unnecessarily.
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)