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 9e087a2 commit 5d46759
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/aof.c
Expand Up @@ -657,6 +657,11 @@ void backgroundRewriteDoneHandler(int statloc) {
if (server.appendfsync != APPENDFSYNC_NO) aof_fsync(fd);
server.appendseldb = -1; /* Make sure it will issue SELECT */
redisLog(REDIS_NOTICE,"The new append only file was selected for future appends.");

/* 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();
} else {
/* If append only is disabled we just generate a dump in this
* format. Why not? */
Expand Down

1 comment on commit 5d46759

@hoterran
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg, a hidden bug for a long time..

Please sign in to comment.