summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-08-06 19:01:54 +0200
committerantirez <antirez@gmail.com>2013-08-07 11:37:49 +0200
commitd5a4c3e84203f7febc17bd935d55d51538a246b5 (patch)
treeb6b03144abef4ec99303e91bb95c8e8a32b88102 /src
parentd2d3ac3fe9808fe63c7d4ef5b92aa22cb1fd82cf (diff)
downloadredis-d5a4c3e84203f7febc17bd935d55d51538a246b5.tar.gz
redis-benchmark: fix db selection when :rand: feature is used.
Diffstat (limited to 'src')
-rw-r--r--src/redis-benchmark.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 202554484..8eb3666b1 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -204,10 +204,16 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
freeReplyObject(reply);
if (c->selectlen) {
+ int j;
+
/* This is the OK from SELECT. Just discard the SELECT
* from the buffer. */
c->pending--;
sdsrange(c->obuf,c->selectlen,-1);
+ /* We also need to fix the pointers to the strings
+ * we need to randomize. */
+ for (j = 0; j < c->randlen; j++)
+ c->randptr[j] -= c->selectlen;
c->selectlen = 0;
continue;
}