diff options
author | dormando <dormando@rydia.net> | 2016-05-31 16:02:54 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2016-06-05 15:01:59 -0700 |
commit | 9517c656723a769da63c29e23755b469de4417d2 (patch) | |
tree | 6765d39d0b7acba17c0ddf7cdc03aab690a3bd9e | |
parent | e15e1d6b967eed53ddcfd61c0c90c38d0b017996 (diff) | |
download | memcached-9517c656723a769da63c29e23755b469de4417d2.tar.gz |
bump some global stats to 64bit uints
total_items is pretty easy to overflow. Upped some of the others just in case.
-rw-r--r-- | doc/protocol.txt | 4 | ||||
-rw-r--r-- | memcached.c | 4 | ||||
-rw-r--r-- | memcached.h | 8 | ||||
-rw-r--r-- | 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; @@ -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); |