In order to trigger the bug what's needed is to call ZINTERSTORE
resulting into an empty set created, bug against a key that already
existed. The command was not propagated, so the replica ended with the
key that the master removed. Sequence of command to reproduce:
redis-cli hset 446 34 905
redis-cli hset 446 393 911
redis-cli zadd 966 0.
085412045980529885 652
redis-cli zadd 645 0.
25081839284432045 280
redis-cli zinterstore 446 2 966 645
zset *dstzset;
dictIterator *di;
dictEntry *de;
zset *dstzset;
dictIterator *di;
dictEntry *de;
/* expect setnum input keys to be given */
setnum = atoi(c->argv[2]->ptr);
/* expect setnum input keys to be given */
setnum = atoi(c->argv[2]->ptr);
redisAssert(op == REDIS_OP_INTER || op == REDIS_OP_UNION);
}
redisAssert(op == REDIS_OP_INTER || op == REDIS_OP_UNION);
}
- dbDelete(c->db,dstkey);
+ if (dbDelete(c->db,dstkey)) {
+ touchWatchedKey(c->db,dstkey);
+ touched = 1;
+ server.dirty++;
+ }
if (dstzset->zsl->length) {
dbAdd(c->db,dstkey,dstobj);
addReplyLongLong(c, dstzset->zsl->length);
if (dstzset->zsl->length) {
dbAdd(c->db,dstkey,dstobj);
addReplyLongLong(c, dstzset->zsl->length);
- touchWatchedKey(c->db,dstkey);
- server.dirty++;
+ if (!touched) touchWatchedKey(c->db,dstkey);
} else {
decrRefCount(dstobj);
addReply(c, shared.czero);
} else {
decrRefCount(dstobj);
addReply(c, shared.czero);