summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-06-09 19:04:31 +0200
committerantirez <antirez@gmail.com>2011-06-09 19:04:31 +0200
commit09d9879963c0138dc846a6f172616ec70fdf1539 (patch)
tree7d6b7f7d4e017218f19d6eb7b4c9fae2b9807820
parent10e987c5fdb398a806f135a8c09888c8e3bf6840 (diff)
downloadredis-09d9879963c0138dc846a6f172616ec70fdf1539.tar.gz
AOF log rewriting in slave performed after a successful sych with the master was misplaced. Now it happens at the right time.
-rw-r--r--src/replication.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index b0fa70556..18822d1f8 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -390,6 +390,8 @@ void readSyncBulkPayload(aeEventLoop *el, int fd, void *privdata, int mask) {
server.master->authenticated = 1;
server.replstate = REDIS_REPL_CONNECTED;
redisLog(REDIS_NOTICE, "MASTER <-> SLAVE sync: Finished with success");
+ /* Rewrite the AOF file now that the dataset changed. */
+ if (server.appendonly) rewriteAppendOnlyFileBackground();
}
}
@@ -519,7 +521,6 @@ void replicationCron(void) {
redisLog(REDIS_NOTICE,"Connecting to MASTER...");
if (syncWithMaster() == REDIS_OK) {
redisLog(REDIS_NOTICE,"MASTER <-> SLAVE sync started: SYNC sent");
- if (server.appendonly) rewriteAppendOnlyFileBackground();
}
}