forked from valkey-io/valkey
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup aof temp files in sigShutdownHandler before exiting
I think this code previously only meant to handle save in shutdown, which means we may a do foreground save in shutdown. It also implicitly handles the backgroud save, for example the child process will also get the chance to call getpid() and clean up the temp RDB file. However, we did not handle AOFRW, so we also leave temp files in here. Noted that we can not use the same aofRemoveTempFile(getpid()) trick for AOF. Since we rename the temp file (temp-rewriteaof-bg-pid.aof) to the base aof file only in backgroundRewriteDoneHandler, and in this time, there is no child process, so the cleanup job must be done by the parent child. The following sequences have been tested (not just signal handlers): 1. Long foreground save + shutdown 2. Long backgroud save + shutdown 3. Long backgroud save + long lua script + shutdown 4. Long bgrewriteaof + shutdown 5. Long bgrewriteaof + long lua script + shutdown 6. Short bgrewriteaof + long done handler + shutdown All temporary files will be removed in the local tests. Signed-off-by: Binbin <[email protected]>
- Loading branch information
1 parent
d00c856
commit ab77b25
Showing
4 changed files
with
43 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters