summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Bugaevskiy <bugaevskiy@yandex-team.ru>2018-09-19 19:58:39 +0300
committerantirez <antirez@gmail.com>2018-10-31 11:49:37 +0100
commit21971ac83cbab9bb8e28324f3b0182c3aa759642 (patch)
tree1a31e7a5aa70f26f608ce573775bdbaef5fd1733
parent3a91fcbcf36479af110e6ceb43a86569659930ad (diff)
downloadredis-21971ac83cbab9bb8e28324f3b0182c3aa759642.tar.gz
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.
-rw-r--r--src/replication.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/replication.c b/src/replication.c
index 3b4059c33..d8478fbbc 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -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 */
while(maxtries--) {
snprintf(tmpfile,256,