memcached/fix-meta-delete.patch
yanshuai01 4ffcf09dce fix meta delete
(cherry picked from commit df627b1f9f3e431d7b4c879c651b72ab0b161978)
2024-06-06 14:22:22 +08:00

36 lines
1.2 KiB
Diff

From 6c4152b636ca7fffe2dd0eb1ddcb3141a303533a Mon Sep 17 00:00:00 2001
From: dormando <dormando@rydia.net>
Date: Wed, 15 Dec 2021 16:01:45 -0800
Subject: [PATCH] meta: fix meta delete
compared cas token was always zero...
---
proto_text.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/proto_text.c b/proto_text.c
index 000ddd1..ddad087 100644
--- a/proto_text.c
+++ b/proto_text.c
@@ -1538,7 +1538,6 @@ error:
static void process_mdelete_command(conn *c, token_t *tokens, const size_t ntokens) {
char *key;
size_t nkey;
- uint64_t req_cas_id = 0;
item *it = NULL;
int i;
uint32_t hv;
@@ -1598,7 +1597,7 @@ static void process_mdelete_command(conn *c, token_t *tokens, const size_t ntoke
MEMCACHED_COMMAND_DELETE(c->sfd, ITEM_key(it), it->nkey);
// allow only deleting/marking if a CAS value matches.
- if (of.has_cas && ITEM_get_cas(it) != req_cas_id) {
+ if (of.has_cas && ITEM_get_cas(it) != of.req_cas_id) {
pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.delete_misses++;
pthread_mutex_unlock(&c->thread->stats.mutex);
--
2.27.0