Skip to content

Commit

Permalink
Fix AOF race that may duplicate commands
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern authored and antirez committed Sep 16, 2011
1 parent 96674b6 commit 5f54a5e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/aof.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,11 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
server.appendseldb = -1; /* Make sure SELECT is re-issued */
aofUpdateCurrentSize();
server.auto_aofrewrite_base_size = server.appendonly_current_size;

/* Clear regular AOF buffer since its contents was just written to
* the new AOF from the background rewrite buffer. */
sdsfree(server.aofbuf);
server.aofbuf = sdsempty();
}

redisLog(REDIS_NOTICE, "Background AOF rewrite successful");
Expand Down

0 comments on commit 5f54a5e

Please sign in to comment.