postpone the AOF fsync if policy is everysec and there is a background fsync already going.

This commit is contained in:
antirez
2011-09-16 12:35:12 +02:00
parent 9a35eb22bf
commit db3c2a4fb4
3 changed files with 54 additions and 8 deletions

View File

@ -697,6 +697,11 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
}
}
/* If we postponed an AOF buffer flush, let's try to do it every time the
* cron function is called. */
if (server.aof_flush_postponed_start) flushAppendOnlyFile(0);
/* Expire a few keys per cycle, only if this is a master.
* On slaves we wait for DEL operations synthesized by the master
* in order to guarantee a strict consistency. */
@ -735,7 +740,7 @@ void beforeSleep(struct aeEventLoop *eventLoop) {
}
/* Write the AOF buffer on disk */
flushAppendOnlyFile();
flushAppendOnlyFile(0);
}
/* =========================== Server initialization ======================== */
@ -822,6 +827,7 @@ void initServerConfig() {
server.lastfsync = time(NULL);
server.appendfd = -1;
server.appendseldb = -1; /* Make sure the first time will not match */
server.aof_flush_postponed_start = 0;
server.pidfile = zstrdup("/var/run/redis.pid");
server.dbfilename = zstrdup("dump.rdb");
server.appendfilename = zstrdup("appendonly.aof");