diff options
author | antirez <antirez@gmail.com> | 2013-11-05 12:16:29 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-11-05 12:16:29 +0100 |
commit | f56f78d15932ea219cfe62e7d07f17034b11a504 (patch) | |
tree | d600a42255845323f6a08d4e969fe3fbc34072e4 /src/db.c | |
parent | 1a0cea33a046324a16846f0abadcff9f61e67d10 (diff) | |
download | redis-f56f78d15932ea219cfe62e7d07f17034b11a504.tar.gz |
HSCAN/ZSCAN: skip value when matching.
This fixes issue #1360 and #1362.
Diffstat (limited to 'src/db.c')
-rw-r--r-- | src/db.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -505,11 +505,16 @@ void scanGenericCommand(redisClient *c, robj *o) { if (filter) { decrRefCount(kobj); listDelNode(keys, node); - /* Also remove the value for hashes and sorted sets. */ - if (o && (o->type == REDIS_ZSET || o->type == REDIS_HASH)) { - node = nextnode; + } + + /* If this is an hash or a sorted set, we have a flat list of + * key-value elements, so if this element was filtered, remove the + * value, or skip it if it was not filtered: we only match keys. */ + if (o && (o->type == REDIS_ZSET || o->type == REDIS_HASH)) { + node = nextnode; + nextnode = listNextNode(node); + if (filter) { kobj = listNodeValue(node); - nextnode = listNextNode(node); decrRefCount(kobj); listDelNode(keys, node); } |