X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/36c17a53b6aece050b79b667fd32064f6eb116c2..b8cfcea4243ef22537bdfefe73fd6c54fc41ee70:/src/redis.c diff --git a/src/redis.c b/src/redis.c index 2fd3ee39..5aabe3bc 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) { @@ -1146,9 +1148,11 @@ sds genRedisInfoString(void) { int j; char hmem[64]; struct rusage self_ru, c_ru; + unsigned long lol, bib; getrusage(RUSAGE_SELF, &self_ru); getrusage(RUSAGE_CHILDREN, &c_ru); + getClientsMaxBuffers(&lol,&bib); bytesToHuman(hmem,zmalloc_used_memory()); info = sdscatprintf(sdsempty(), @@ -1167,6 +1171,8 @@ sds genRedisInfoString(void) { "used_cpu_user_childrens:%.2f\r\n" "connected_clients:%d\r\n" "connected_slaves:%d\r\n" + "client_longest_output_list:%lu\r\n" + "client_biggest_input_buf:%lu\r\n" "blocked_clients:%d\r\n" "used_memory:%zu\r\n" "used_memory_human:%s\r\n" @@ -1206,6 +1212,7 @@ sds genRedisInfoString(void) { (float)c_ru.ru_stime.tv_sec+(float)c_ru.ru_stime.tv_usec/1000000, listLength(server.clients)-listLength(server.slaves), listLength(server.slaves), + lol, bib, server.bpop_blocked_clients, zmalloc_used_memory(), hmem, @@ -1219,7 +1226,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 +1305,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;