diff options
author | michael-grunder <michael.grunder@gmail.com> | 2014-02-21 18:12:32 +0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2014-02-21 18:12:32 +0400 |
commit | 9eaf14756b37d6b63567070385da2b304ed4bd70 (patch) | |
tree | e52ab4e66278f5737b3ffef37665b071c2c65f66 /redis_array.c | |
parent | 43b35a4737d3582481ff85b6506f711f8383c723 (diff) |
Don't attempt MGET on nodes where no keys resolve
The MGET call in RedisArray was failing under circumstances where
none of the passed keys hashed into any given node in the ring.
What was happening is that RedisArray was passing through to the
phpredis MGET command an empty array, which was returning false.
This in turn caused RedisArray to abort the process and return
false as well.
This change updates RedisArray MGET such that if a given node
doesn't have any keys, we skip the call to it all together.
Addresses #435
Addresses #436
Diffstat (limited to 'redis_array.c')
-rw-r--r-- | redis_array.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/redis_array.c b/redis_array.c index ecc158ea..2c431424 100644 --- a/redis_array.c +++ b/redis_array.c @@ -876,7 +876,10 @@ PHP_METHOD(RedisArray, mget) /* calls */ for(n = 0; n < ra->count; ++n) { /* for each node */ - /* copy args for MGET call on node. */ + /* We don't even need to make a call to this node if no keys go there */ + if(!argc_each[n]) continue; + + /* copy args for MGET call on node. */ MAKE_STD_ZVAL(z_argarray); array_init(z_argarray); |