X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/36c17a53b6aece050b79b667fd32064f6eb116c2..322ea972fe945a8cf439e9e3577de624f3e3e10b:/src/redis.c diff --git a/src/redis.c b/src/redis.c index 2fd3ee39..4f676a48 100644 --- a/src/redis.c +++ b/src/redis.c @@ -583,7 +583,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { if ((server.maxidletime && !(loops % 100)) || server.bpop_blocked_clients) closeTimedoutClients(); - /* Check if a background saving or AOF rewrite in progress terminated */ + /* Check if a background saving or AOF rewrite in progress terminated. */ if (server.bgsavechildpid != -1 || server.bgrewritechildpid != -1) { int statloc; pid_t pid; @@ -601,6 +601,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { } updateDictResizePolicy(); } + } else if (server.bgsavethread != (pthread_t) -1) { if (server.bgsavethread != (pthread_t) -1) { int state; @@ -608,10 +609,11 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { state = server.bgsavethread_state; pthread_mutex_unlock(&server.bgsavethread_mutex); - if (state == REDIS_BGSAVE_DONE_OK || state == REDIS_BGSAVE_DONE_ERR) + if (state == REDIS_BGSAVE_THREAD_DONE_OK || + state == REDIS_BGSAVE_THREAD_DONE_ERR) { backgroundSaveDoneHandler( - (state == REDIS_BGSAVE_DONE_OK) ? 0 : 1, 0); + (state == REDIS_BGSAVE_THREAD_DONE_OK) ? 0 : 1, 0); } } } else if (!server.ds_enabled) { @@ -1219,7 +1221,7 @@ sds genRedisInfoString(void) { server.loading, server.appendonly, server.dirty, - server.bgsavechildpid != -1, + server.bgsavechildpid != -1 || server.bgsavethread != (pthread_t) -1, server.lastsave, server.bgrewritechildpid != -1, server.stat_numconnections, @@ -1298,6 +1300,19 @@ sds genRedisInfoString(void) { eta ); } + + info = sdscat(info,"allocation_stats:"); + for (j = 0; j <= ZMALLOC_MAX_ALLOC_STAT; j++) { + size_t count = zmalloc_allocations_for_size(j); + if (count) { + if (info[sdslen(info)-1] != ':') info = sdscatlen(info,",",1); + info = sdscatprintf(info,"%s%d=%zu", + (j == ZMALLOC_MAX_ALLOC_STAT) ? ">=" : "", + j,count); + } + } + info = sdscat(info,"\r\n"); + for (j = 0; j < server.dbnum; j++) { long long keys, vkeys;