Commit 9682295f authored by antirez's avatar antirez
Browse files

PFCOUNT: unshare the object when cached cardinality is modified.

parent be9860d0
...@@ -541,6 +541,9 @@ void pfcountCommand(redisClient *c) { ...@@ -541,6 +541,9 @@ void pfcountCommand(redisClient *c) {
card |= (uint64_t)registers[REDIS_HLL_SIZE-9] << 56; card |= (uint64_t)registers[REDIS_HLL_SIZE-9] << 56;
} else { } else {
/* Recompute it and update the cached value. */ /* Recompute it and update the cached value. */
o = dbUnshareStringValue(c->db,c->argv[1],o);
registers = o->ptr;
card = hllCount(registers); card = hllCount(registers);
registers[REDIS_HLL_SIZE-16] = card & 0xff; registers[REDIS_HLL_SIZE-16] = card & 0xff;
registers[REDIS_HLL_SIZE-15] = (card >> 8) & 0xff; registers[REDIS_HLL_SIZE-15] = (card >> 8) & 0xff;
......
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