Commit 21971ac8 authored by Andrey Bugaevskiy's avatar Andrey Bugaevskiy Committed by antirez
Browse files

Prevent RDB autosave from overwriting full resync results

During the full database resync we may still have unsaved changes
on the receiving side. This causes a race condition between
synced data rename/load and the rename of rdbSave tempfile.
parent 3a91fcbc
...@@ -1806,6 +1806,13 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -1806,6 +1806,13 @@ void syncWithMaster(aeEventLoop *el, int fd, void *privdata, int mask) {
} }
} }
/* Stop background saving for obsolete database state. */
server.dirty = 0;
if (server.rdb_child_pid != -1) {
kill(server.rdb_child_pid,SIGUSR1);
rdbRemoveTempFile(server.rdb_child_pid);
}
/* Prepare a suitable temp file for bulk transfer */ /* Prepare a suitable temp file for bulk transfer */
while(maxtries--) { while(maxtries--) {
snprintf(tmpfile,256, snprintf(tmpfile,256,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment