mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 00:31:21 +00:00
Re-use AOF buffer when it is small enough
This commit is contained in:
committed by
antirez
parent
a57225c2cf
commit
f990782f4d
11
src/aof.c
11
src/aof.c
@ -81,10 +81,17 @@ void flushAppendOnlyFile(void) {
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
sdsfree(server.aofbuf);
|
||||
server.aofbuf = sdsempty();
|
||||
server.appendonly_current_size += nwritten;
|
||||
|
||||
/* Re-use AOF buffer when it is small enough. The maximum comes from the
|
||||
* arena size of 4k minus some overhead (but is otherwise arbitrary). */
|
||||
if ((sdslen(server.aofbuf)+sdsavail(server.aofbuf)) < 4000) {
|
||||
sdsclear(server.aofbuf);
|
||||
} else {
|
||||
sdsfree(server.aofbuf);
|
||||
server.aofbuf = sdsempty();
|
||||
}
|
||||
|
||||
/* Don't fsync if no-appendfsync-on-rewrite is set to yes and there are
|
||||
* children doing I/O in the background. */
|
||||
if (server.no_appendfsync_on_rewrite &&
|
||||
|
Reference in New Issue
Block a user