summaryrefslogtreecommitdiff
path: root/src/replication.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2010-11-12 20:02:20 +0100
committerantirez <antirez@gmail.com>2010-11-12 20:02:20 +0100
commit9fd01051bf8400babcca73a76a67dfc1847633ff (patch)
tree6c4f5b03f18ab5dab825e79e55f0c9a92c8e1494 /src/replication.c
parent0c2f75c6d809a1658a244e74ef209dabb19fb4c7 (diff)
downloadredis-9fd01051bf8400babcca73a76a67dfc1847633ff.tar.gz
Fix for bug 374, thanks to Jeremy Zawodny for reporting and tracing why it was crashing.
Diffstat (limited to 'src/replication.c')
-rw-r--r--src/replication.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index f6ecc1c66..a49aa2d8e 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -366,13 +366,17 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
}
redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Loading DB in memory");
emptyDb();
+ /* Before loading the DB into memory we need to delete the readable
+ * handler, otherwise it will get called recursively since
+ * rdbLoad() will call the event loop to process events from time to
+ * time for non blocking loading. */
+ aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE);
if (rdbLoad(server.dbfilename) != REDIS_OK) {
redisLog(REDIS_WARNING,"Failed trying to load the MASTER synchronization DB from disk");
replicationAbortSyncTransfer();
return;
}
/* Final setup of the connected slave <- master link */
- aeDeleteFileEvent(server.el,server.repl_transfer_s,AE_READABLE);
zfree(server.repl_transfer_tmpfile);
close(server.repl_transfer_fd);
server.master = createClient(server.repl_transfer_s);