diff options
author | Kevin Lin <developer@kevinlin.info> | 2021-10-01 18:59:24 -0700 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2021-11-23 15:58:17 -0800 |
commit | cc0f24bca33d7e8a708b2d6405f39b5044b722ed (patch) | |
tree | c15dd39c767cb866bac2ac2f3e0f749b54f7cfd2 /proto_text.c | |
parent | 75e4d574b34c6e3b5dd9330acd61097b75cdf1d3 (diff) | |
download | memcached-cc0f24bca33d7e8a708b2d6405f39b5044b722ed.tar.gz |
Track store errors in thread stats
Add two new stat keys, `store_too_large` and `store_no_memory`, to track
occurrences of storage request rejections due to writing too large of a
value and writing beyond available provisioned memory, respectively.
Diffstat (limited to 'proto_text.c')
-rw-r--r-- | proto_text.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/proto_text.c b/proto_text.c index 6cc1f66..e33c204 100644 --- a/proto_text.c +++ b/proto_text.c @@ -1480,9 +1480,15 @@ static void process_mset_command(conn *c, token_t *tokens, const size_t ntokens) if (! item_size_ok(nkey, of.client_flags, vlen)) { errstr = "SERVER_ERROR object too large for cache"; status = TOO_LARGE; + pthread_mutex_lock(&c->thread->stats.mutex); + c->thread->stats.store_too_large++; + pthread_mutex_unlock(&c->thread->stats.mutex); } else { errstr = "SERVER_ERROR out of memory storing object"; status = NO_MEMORY; + pthread_mutex_lock(&c->thread->stats.mutex); + c->thread->stats.store_no_memory++; + pthread_mutex_unlock(&c->thread->stats.mutex); } // FIXME: LOGGER_LOG specific to mset, include options. LOGGER_LOG(c->thread->l, LOG_MUTATIONS, LOGGER_ITEM_STORE, @@ -1962,9 +1968,15 @@ static void process_update_command(conn *c, token_t *tokens, const size_t ntoken if (! item_size_ok(nkey, flags, vlen)) { out_string(c, "SERVER_ERROR object too large for cache"); status = TOO_LARGE; + pthread_mutex_lock(&c->thread->stats.mutex); + c->thread->stats.store_too_large++; + pthread_mutex_unlock(&c->thread->stats.mutex); } else { out_of_memory(c, "SERVER_ERROR out of memory storing object"); status = NO_MEMORY; + pthread_mutex_lock(&c->thread->stats.mutex); + c->thread->stats.store_no_memory++; + pthread_mutex_unlock(&c->thread->stats.mutex); } LOGGER_LOG(c->thread->l, LOG_MUTATIONS, LOGGER_ITEM_STORE, NULL, status, comm, key, nkey, 0, 0, c->sfd); |