Permalink
Browse files

AOF log rewriting in slave performed after a successful sych with the…

… master was misplaced. Now it happens at the right time.
  • Loading branch information...
1 parent 10e987c commit 09d9879963c0138dc846a6f172616ec70fdf1539 @antirez committed Jun 9, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/replication.c
View
@@ -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();
}
}

0 comments on commit 09d9879

Please sign in to comment.