diff options
author | antirez <antirez@gmail.com> | 2011-09-16 11:08:39 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2011-09-19 17:43:40 +0200 |
commit | f85c383b6c44557cd03e8dc27fb590a9267eb94a (patch) | |
tree | 60129538177767706553177dff4d0106516e101d | |
parent | 3ae56d845859428dba9130d982bea1d8e72798a9 (diff) | |
download | redis-f85c383b6c44557cd03e8dc27fb590a9267eb94a.tar.gz |
Added aof_backgronud_fsync() function, and use it in the bacground rewrite done handler when the fsync policy is everysec.
-rw-r--r-- | src/aof.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -11,6 +11,10 @@ void aofUpdateCurrentSize(void); +void aof_background_fsync(int fd) { + bioCreateBackgroundJob(REDIS_BIO_AOF_FSYNC,(void*)(long)fd,NULL); +} + /* Called when the user switches from "appendonly yes" to "appendonly no" * at runtime using the CONFIG command. */ void stopAppendOnly(void) { @@ -791,7 +795,10 @@ void backgroundRewriteDoneHandler(int statloc) { /* AOF enabled, replace the old fd with the new one. */ oldfd = server.appendfd; server.appendfd = newfd; - if (server.appendfsync != APPENDFSYNC_NO) aof_fsync(newfd); + if (server.appendfsync == APPENDFSYNC_ALWAYS) + aof_fsync(newfd); + else if (server.appendfsync == APPENDFSYNC_EVERYSEC) + aof_background_fsync(newfd); server.appendseldb = -1; /* Make sure SELECT is re-issued */ aofUpdateCurrentSize(); server.auto_aofrewrite_base_size = server.appendonly_current_size; |