X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/f6433915fea3ed68a26f7af42becc14f9483acac..d841dedb5fc4b33eff47ee05f517bca9cabd7533:/src/replication.c diff --git a/src/replication.c b/src/replication.c index f6ecc1c6..9f8d9274 100644 --- a/src/replication.c +++ b/src/replication.c @@ -88,7 +88,7 @@ void replicationFeedMonitors(list *monitors, int dictid, robj **argv, int argc) struct timeval tv; gettimeofday(&tv,NULL); - cmdrepr = sdscatprintf(cmdrepr,"%ld.%ld ",(long)tv.tv_sec,(long)tv.tv_usec); + cmdrepr = sdscatprintf(cmdrepr,"%ld.%06ld ",(long)tv.tv_sec,(long)tv.tv_usec); if (dictid != 0) cmdrepr = sdscatprintf(cmdrepr,"(db %d) ", dictid); for (j = 0; j < argc; j++) { @@ -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);