summaryrefslogtreecommitdiff
path: root/proxy_internal.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-03-06 15:21:39 -0800
committerdormando <dormando@rydia.net>2023-03-06 18:10:21 -0800
commitdead60dd43d1b7213ac046d237920eff44b3f68b (patch)
treeb514f6f6cd99325b49c7ddb71ce710eed3dc786e /proxy_internal.c
parent9e740a9abbe72f49bef026c85464f68e0e46757c (diff)
downloadmemcached-dead60dd43d1b7213ac046d237920eff44b3f68b.tar.gz
proxy: mcp.internal fixes and tests
- Refcount leak on sets - Move the response elapsed timer back closer to when the response was processed as to not clobber the wrong IO object data - Restores error messages from set/ms - Adds start of unit tests Requests will look like they run a tiiiiny bit faster than they do, but I need to get the elapsed time there for a later change.
Diffstat (limited to 'proxy_internal.c')
-rw-r--r--proxy_internal.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/proxy_internal.c b/proxy_internal.c
index a193c16..f0254f6 100644
--- a/proxy_internal.c
+++ b/proxy_internal.c
@@ -347,13 +347,13 @@ static void process_update_cmd(LIBEVENT_THREAD *t, mcp_parser_t *pr, mc_resp *re
if (it == 0) {
//enum store_item_type status;
if (! item_size_ok(nkey, flags, pr->vlen)) {
- //out_string(c, "SERVER_ERROR object too large for cache");
+ pout_string(resp, "SERVER_ERROR object too large for cache");
//status = TOO_LARGE;
pthread_mutex_lock(&t->stats.mutex);
t->stats.store_too_large++;
pthread_mutex_unlock(&t->stats.mutex);
} else {
- //out_of_memory(c, "SERVER_ERROR out of memory storing object");
+ pout_string(resp, "SERVER_ERROR out of memory storing object");
//status = NO_MEMORY;
pthread_mutex_lock(&t->stats.mutex);
t->stats.store_no_memory++;
@@ -407,6 +407,8 @@ static void process_update_cmd(LIBEVENT_THREAD *t, mcp_parser_t *pr, mc_resp *re
pout_string(resp, "SERVER_ERROR Unhandled storage type.");
}
+ // We don't need to hold a reference since the item was fully read.
+ item_remove(it);
}
static void process_arithmetic_cmd(LIBEVENT_THREAD *t, mcp_parser_t *pr, mc_resp *resp, const bool incr) {
@@ -1214,6 +1216,8 @@ static void process_mset_cmd(LIBEVENT_THREAD *t, mcp_parser_t *pr, mc_resp *resp
resp->wbytes = p - resp->wbuf;
resp_add_iov(resp, resp->wbuf, resp->wbytes);
+ item_remove(it);
+
return;
error:
// Note: no errors possible after the item was successfully allocated.