]> git.saurik.com Git - redis.git/commitdiff
Fix for a possible bug related to ZINTER/UNIONSTORE called with the same source set...
authorantirez <antirez@gmail.com>
Sun, 15 May 2011 13:33:01 +0000 (15:33 +0200)
committerantirez <antirez@gmail.com>
Sun, 15 May 2011 13:33:01 +0000 (15:33 +0200)
src/t_zset.c

index 3e76ebd1517c1c690ee4a53c16d0d6988dd179ec..8b1662091f1a0516efd1c9e0b5c05641fbbb5427 100644 (file)
@@ -1521,7 +1521,10 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
 
                 score = src[0].weight * zval.score;
                 for (j = 1; j < setnum; j++) {
-                    if (zuiFind(&src[j],&zval,&value)) {
+                    if (src[j].subject == src[0].subject) {
+                        value = zval.score*src[j].weight;
+                        zunionInterAggregate(&score,value,aggregate);
+                    } else if (zuiFind(&src[j],&zval,&value)) {
                         value *= src[j].weight;
                         zunionInterAggregate(&score,value,aggregate);
                     } else {