Commit 6cbfdd95 authored by antirez's avatar antirez
Browse files

redis-benchmark: fix db selection when :rand: feature is used.

parent d52c9b6c
...@@ -205,10 +205,16 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) { ...@@ -205,10 +205,16 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
freeReplyObject(reply); freeReplyObject(reply);
if (c->selectlen) { if (c->selectlen) {
int j;
/* This is the OK from SELECT. Just discard the SELECT /* This is the OK from SELECT. Just discard the SELECT
* from the buffer. */ * from the buffer. */
c->pending--; c->pending--;
sdsrange(c->obuf,c->selectlen,-1); 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; c->selectlen = 0;
continue; continue;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment