Fix AOF race that may duplicate commands

This commit is contained in:
Pieter Noordhuis 2011-08-17 18:15:06 +02:00 committed by antirez
parent 6fd1a72712
commit 682b63312e

View File

@ -795,6 +795,11 @@ void backgroundRewriteDoneHandler(int statloc) {
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");