Skip to content

Commit

Permalink
PFCOUNT: unshare the object when cached cardinality is modified.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Apr 3, 2014
1 parent be9860d commit 9682295
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hyperloglog.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,9 @@ void pfcountCommand(redisClient *c) {
card |= (uint64_t)registers[REDIS_HLL_SIZE-9] << 56;
} else {
/* Recompute it and update the cached value. */
o = dbUnshareStringValue(c->db,c->argv[1],o);
registers = o->ptr;

card = hllCount(registers);
registers[REDIS_HLL_SIZE-16] = card & 0xff;
registers[REDIS_HLL_SIZE-15] = (card >> 8) & 0xff;
Expand Down

0 comments on commit 9682295

Please sign in to comment.