mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Hyperloglog: refresh hdr variable correctly.
This is a fix for the #3819 improvements. The o->ptr may change because of hllSparseSet() calls, so 'hdr' must be correctly re-fetched.
This commit is contained in:
parent
27b81f3fbc
commit
0b561883b4
@ -1347,14 +1347,16 @@ void pfmergeCommand(client *c) {
|
|||||||
|
|
||||||
/* Write the resulting HLL to the destination HLL registers and
|
/* Write the resulting HLL to the destination HLL registers and
|
||||||
* invalidate the cached value. */
|
* invalidate the cached value. */
|
||||||
hdr = o->ptr;
|
|
||||||
for (j = 0; j < HLL_REGISTERS; j++) {
|
for (j = 0; j < HLL_REGISTERS; j++) {
|
||||||
if (max[j] == 0) continue;
|
if (max[j] == 0) continue;
|
||||||
|
hdr = o->ptr;
|
||||||
switch(hdr->encoding) {
|
switch(hdr->encoding) {
|
||||||
case HLL_DENSE: hllDenseSet(hdr->registers,j,max[j]); break;
|
case HLL_DENSE: hllDenseSet(hdr->registers,j,max[j]); break;
|
||||||
case HLL_SPARSE: hllSparseSet(o,j,max[j]); break;
|
case HLL_SPARSE: hllSparseSet(o,j,max[j]); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hdr = o->ptr; /* o->ptr may be different now, as a side effect of
|
||||||
|
last hllSparseSet() call. */
|
||||||
HLL_INVALIDATE_CACHE(hdr);
|
HLL_INVALIDATE_CACHE(hdr);
|
||||||
|
|
||||||
signalModifiedKey(c->db,c->argv[1]);
|
signalModifiedKey(c->db,c->argv[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user