From 9517c656723a769da63c29e23755b469de4417d2 Mon Sep 17 00:00:00 2001 From: dormando Date: Tue, 31 May 2016 16:02:54 -0700 Subject: bump some global stats to 64bit uints total_items is pretty easy to overflow. Upped some of the others just in case. --- doc/protocol.txt | 4 ++-- memcached.c | 4 ++-- memcached.h | 8 ++++---- slabs.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/protocol.txt b/doc/protocol.txt index eaa3b16..3e6313a 100644 --- a/doc/protocol.txt +++ b/doc/protocol.txt @@ -522,8 +522,8 @@ integers separated by a colon (treat this as a floating point number). | | | (seconds:microseconds) | | rusage_system | 32u.32u | Accumulated system time for this process | | | | (seconds:microseconds) | -| curr_items | 32u | Current number of items stored | -| total_items | 32u | Total number of items stored since | +| curr_items | 64u | Current number of items stored | +| total_items | 64u | Total number of items stored since | | | | the server started | | bytes | 64u | Current number of bytes used | | | | to store items | diff --git a/memcached.c b/memcached.c index 8e81ad8..61322e9 100644 --- a/memcached.c +++ b/memcached.c @@ -2600,8 +2600,8 @@ static void server_stats(ADD_STAT add_stats, conn *c) { (long)usage.ru_stime.tv_usec); #endif /* !WIN32 */ - APPEND_STAT("curr_connections", "%u", stats.curr_conns - 1); - APPEND_STAT("total_connections", "%u", stats.total_conns); + APPEND_STAT("curr_connections", "%llu", (unsigned long long)stats.curr_conns - 1); + APPEND_STAT("total_connections", "%llu", (unsigned long long)stats.total_conns); if (settings.maxconns_fast) { APPEND_STAT("rejected_connections", "%llu", (unsigned long long)stats.rejected_conns); } diff --git a/memcached.h b/memcached.h index e53e642..445e122 100644 --- a/memcached.h +++ b/memcached.h @@ -259,11 +259,11 @@ struct thread_stats { */ struct stats { pthread_mutex_t mutex; - unsigned int curr_items; - unsigned int total_items; + uint64_t curr_items; + uint64_t total_items; uint64_t curr_bytes; - unsigned int curr_conns; - unsigned int total_conns; + uint64_t curr_conns; + uint64_t total_conns; uint64_t rejected_conns; uint64_t malloc_fails; unsigned int reserved_fds; diff --git a/slabs.c b/slabs.c index bfafe5d..6729aea 100644 --- a/slabs.c +++ b/slabs.c @@ -322,8 +322,8 @@ bool get_stats(const char *stat_type, int nkey, ADD_STAT add_stats, void *c) { /* prepare general statistics for the engine */ STATS_LOCK(); APPEND_STAT("bytes", "%llu", (unsigned long long)stats.curr_bytes); - APPEND_STAT("curr_items", "%u", stats.curr_items); - APPEND_STAT("total_items", "%u", stats.total_items); + APPEND_STAT("curr_items", "%llu", (unsigned long long)stats.curr_items); + APPEND_STAT("total_items", "%llu", (unsigned long long)stats.total_items); STATS_UNLOCK(); if (settings.slab_automove > 0) { pthread_mutex_lock(&slabs_lock); -- cgit v1.2.1