From cc24447a1a9c05b04b369106776d01e95c91c4c9 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 4 Jul 2014 16:03:46 +0200 Subject: [PATCH] Use amount of I/O not ops to trigger aofReadDiffFromParent(). --- src/aof.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aof.c b/src/aof.c index 1db1739b..b666154f 100644 --- a/src/aof.c +++ b/src/aof.c @@ -965,8 +965,8 @@ int rewriteAppendOnlyFile(char *filename) { char tmpfile[256]; int j; long long now = mstime(); - unsigned long ops = 0; char byte; + size_t processed = 0; /* Note that we have to use a different temp name here compared to the * one used by rewriteAppendOnlyFileBackground() function. */ @@ -1038,7 +1038,10 @@ int rewriteAppendOnlyFile(char *filename) { if (rioWriteBulkLongLong(&aof,expiretime) == 0) goto werr; } /* Read some diff from the parent process from time to time. */ - if (ops++ % 1000) aofReadDiffFromParent(); + if (aof.processed_bytes > processed+REDIS_AOF_AUTOSYNC_BYTES) { + processed = aof.processed_bytes; + aofReadDiffFromParent(); + } } dictReleaseIterator(di); }