diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2011-08-17 18:15:06 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2011-09-16 11:22:29 +0200 |
commit | 5d4675979de5d2f6709658f4e3e6344182d8f35e (patch) | |
tree | 271bce5c7645a9b84a0da20cb8e2ea65cd078c2d | |
parent | 9e087a298dc798b5664654d0934d27762e76092e (diff) | |
download | redis-5d4675979de5d2f6709658f4e3e6344182d8f35e.tar.gz |
Fix AOF race that may duplicate commands
-rw-r--r-- | src/aof.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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? */ |