diff --git a/src/aof.c b/src/aof.c index c629bed4..ac50d572 100644 --- a/src/aof.c +++ b/src/aof.c @@ -855,6 +855,7 @@ int rewriteAppendOnlyFile(char *filename) { } rioInitWithFile(&aof,fp); + rioSetAutoSync(&aof,REDIS_AOF_AUTOSYNC_BYTES); for (j = 0; j < server.dbnum; j++) { char selectcmd[] = "*2\r\n$6\r\nSELECT\r\n"; redisDb *db = server.db+j; diff --git a/src/redis.h b/src/redis.h index d4f6b7f9..dbe23fe4 100644 --- a/src/redis.h +++ b/src/redis.h @@ -106,6 +106,7 @@ #define REDIS_INLINE_MAX_SIZE (1024*64) /* Max size of inline reads */ #define REDIS_MBULK_BIG_ARG (1024*32) #define REDIS_LONGSTR_SIZE 21 /* Bytes needed for long -> str */ +#define REDIS_AOF_AUTOSYNC_BYTES (1024*1024*32) /* fdatasync every 32MB */ /* Hash table parameters */ #define REDIS_HT_MINFILL 10 /* Minimal hash table fill 10% */