From efccd6353bacec9addc7278292fd8c3108d116e4 Mon Sep 17 00:00:00 2001 From: filipe oliveira Date: Sun, 14 Feb 2021 12:42:41 +0000 Subject: [PATCH] redis-benchmark: Fix broken protocol when used with -a or --dbnum (#8486) Fix the pointers to the slot hash tags in the case of prefixed commands usage i.e. AUTH / SELECT It adjusts the pointers to the slot hash tags in the case of prefixed commands usage as soon as we get the 1st reply (same like we already did for the random strings within the command ) --- src/redis-benchmark.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 164f5e3ee..186739766 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -567,6 +567,9 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) { * we need to randomize. */ for (j = 0; j < c->randlen; j++) c->randptr[j] -= c->prefixlen; + /* Fix the pointers to the slot hash tags */ + for (j = 0; j < c->staglen; j++) + c->stagptr[j] -= c->prefixlen; c->prefixlen = 0; } continue;