summaryrefslogtreecommitdiff
path: root/src/tracking.c
diff options
context:
space:
mode:
authorHuang Zw <huang_zhw@126.com>2021-02-21 15:34:46 +0800
committerGitHub <noreply@github.com>2021-02-21 09:34:46 +0200
commitf687ac0c32e3857aff56ddc4711be18dd87c336c (patch)
tree5f8a516e02df657fee6bb25c4342ae63aec5e402 /src/tracking.c
parent0772098b1b8587266e3a459d9b1225e6e5d4ce58 (diff)
downloadredis-f687ac0c32e3857aff56ddc4711be18dd87c336c.tar.gz
Client tracking tracking-redir-broken push len is 2 not 3 (#8456)
When redis responds with tracking-redir-broken push message (RESP3), it was responding with a broken protocol: an array of 3 elements, but only pushes 2 elements. Some bugs in the test make this pass. Read the push reply will consume an extra reply, because the reply length is 3, but there are only two elements, so the next reply will be treated as third element. So the test is corrected too. Other changes: * checkPrefixCollisionsOrReply success should return 1 instead of -1, this bug didn't have any implications. * improve client tracking tests to validate more of the response it reads.
Diffstat (limited to 'src/tracking.c')
-rw-r--r--src/tracking.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tracking.c b/src/tracking.c
index 1cf226e52..a11e4b7d7 100644
--- a/src/tracking.c
+++ b/src/tracking.c
@@ -147,7 +147,7 @@ int checkPrefixCollisionsOrReply(client *c, robj **prefixes, size_t numprefix) {
}
}
}
- return -1;
+ return 1;
}
/* Set the client 'c' to track the prefix 'prefix'. If the client 'c' is
@@ -269,7 +269,7 @@ void sendTrackingMessage(client *c, char *keyname, size_t keylen, int proto) {
* are unable to send invalidation messages to the redirected
* connection, because the client no longer exist. */
if (c->resp > 2) {
- addReplyPushLen(c,3);
+ addReplyPushLen(c,2);
addReplyBulkCBuffer(c,"tracking-redir-broken",21);
addReplyLongLong(c,c->client_tracking_redirection);
}