mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
Fix: when aof_write_rewrite is true don't append on the AOF buffer but accumulate the differences for the rewrite.
This commit is contained in:
parent
e7a2e7c1f7
commit
087f414090
19
src/aof.c
19
src/aof.c
@ -224,15 +224,9 @@ sds catAppendOnlyExpireAtCommand(sds buf, struct redisCommand *cmd, robj *key, r
|
||||
}
|
||||
|
||||
void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int argc) {
|
||||
sds buf;
|
||||
sds buf = sdsempty();
|
||||
robj *tmpargv[3];
|
||||
|
||||
/* Return ASAP if we are writing a rewrite to finish in order to start
|
||||
* appending to the Append Only File. */
|
||||
if (server.aof_wait_rewrite) return;
|
||||
|
||||
buf = sdsempty();
|
||||
|
||||
/* The DB this command was targetting is not the same as the last command
|
||||
* we appendend. To issue a SELECT command is needed. */
|
||||
if (dictid != server.appendseldb) {
|
||||
@ -265,8 +259,15 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a
|
||||
|
||||
/* Append to the AOF buffer. This will be flushed on disk just before
|
||||
* of re-entering the event loop, so before the client will get a
|
||||
* positive reply about the operation performed. */
|
||||
server.aofbuf = sdscatlen(server.aofbuf,buf,sdslen(buf));
|
||||
* positive reply about the operation performed.
|
||||
*
|
||||
* Note, we don't add stuff in the AOF buffer if aof_wait_rewrite is
|
||||
* non zero, as this means we are starting with a new AOF and the
|
||||
* current one is meaningless (this happens for instance after
|
||||
* a slave resyncs with its master). */
|
||||
if (!server.aof_wait_rewrite) {
|
||||
server.aofbuf = sdscatlen(server.aofbuf,buf,sdslen(buf));
|
||||
}
|
||||
|
||||
/* If a background append only file rewriting is in progress we want to
|
||||
* accumulate the differences between the child DB and the current one
|
||||
|
Loading…
x
Reference in New Issue
Block a user