X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/d630abcdaf869345fed8fe508774d0318d1d82ff..7d9ba156690b0eef1167f8ed9c5d1d3e09e1948e:/src/redis.c?ds=inline diff --git a/src/redis.c b/src/redis.c index bf51db9d..1a1f84f9 100644 --- a/src/redis.c +++ b/src/redis.c @@ -692,14 +692,16 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { } /* Trigger an AOF rewrite if needed */ - if (server.auto_aofrewrite_perc && + if (server.bgsavechildpid == -1 && + server.bgrewritechildpid == -1 && + server.auto_aofrewrite_perc && server.appendonly_current_size > server.auto_aofrewrite_min_size) { int base = server.auto_aofrewrite_base_size ? server.auto_aofrewrite_base_size : 1; - long long growth = (server.appendonly_current_size*100/base); + long long growth = (server.appendonly_current_size*100/base) - 100; if (growth >= server.auto_aofrewrite_perc) { - redisLog(REDIS_NOTICE,"Starting automatic rewriting of AOF on %lld growth",growth); + redisLog(REDIS_NOTICE,"Starting automatic rewriting of AOF on %lld%% growth",growth); rewriteAppendOnlyFileBackground(); } } @@ -899,6 +901,7 @@ void initServerConfig() { server.replstate = REDIS_REPL_NONE; server.repl_syncio_timeout = REDIS_REPL_SYNCIO_TIMEOUT; server.repl_serve_stale_data = 1; + server.repl_down_since = -1; /* Double constants initialization */ R_Zero = 0.0; @@ -1354,7 +1357,7 @@ sds genRedisInfoString(char *section) { server.stat_peak_memory, peak_hmem, zmalloc_get_fragmentation_ratio(), - REDIS_MALLOC + ZMALLOC_LIB ); } @@ -1520,6 +1523,12 @@ sds genRedisInfoString(char *section) { (int)(time(NULL)-server.repl_transfer_lastio) ); } + + if (server.replstate != REDIS_REPL_CONNECTED) { + info = sdscatprintf(info, + "master_link_down_since_seconds:%ld\r\n", + (long)time(NULL)-server.repl_down_since); + } } info = sdscatprintf(info, "connected_slaves:%d\r\n",