提交 450fd83a 编写于 作者: J jonathan pickett

I found a case where the temp-rewriteaof-old-xxxx.aof files were not being...

I found a case where the temp-rewriteaof-old-xxxx.aof files were not being deleted. Added the _O_TEMPORARY flag to the open() call to guarantee that the underlying CreateFile call is being called with the FILE_FLAG_DELETE_ON_CLOSE.
上级 bd27d3bd
......@@ -1349,7 +1349,10 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
goto cleanup;
}
if (server.aof_fd != -1) {
server.aof_fd = open(tmpfile_old, O_WRONLY|O_APPEND|O_CREAT|_O_BINARY,0644);
server.aof_fd = open(
tmpfile_old,
O_WRONLY|O_APPEND|O_CREAT|_O_BINARY|_O_TEMPORARY, // _O_TEMPORARY forces delete on close flag in CreateFile call. File will be deleted in REDIS_BIO_CLOSE_FILE job.
0644);
}
#else
if (server.aof_fd == -1) {
......@@ -1427,9 +1430,6 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
cleanup:
aofRewriteBufferReset();
aofRemoveTempFile(server.aof_child_pid);
#ifdef _WIN32
unlink(tmpfile_old);
#endif
server.aof_child_pid = -1;
server.aof_rewrite_time_last = time(NULL)-server.aof_rewrite_time_start;
server.aof_rewrite_time_start = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册