Commit ba0afb45 authored by antirez's avatar antirez
Browse files

Added assertion in hllSparseAdd() when promotion to dense occurs.

If we converted to dense, a register must be updated in the dense
representation.
parent e9cd51c7
......@@ -865,7 +865,17 @@ updated:
promote: /* Promote to dense representation. */
if (hllSparseToDense(o) == REDIS_ERR) return -1; /* Corrupted HLL. */
hdr = o->ptr;
return hllDenseAdd(hdr->registers, ele, elesize);
/* We need to call hllDenseAdd() to perform the operation after the
* conversion. However the result must be 1, since if we need to
* convert from sparse to dense a register requires to be updated.
*
* Note that this in turn means that PFADD will make sure the command
* is propagated to slaves / AOF, so if there is a sparse -> dense
* convertion, it will be performed in all the slaves as well. */
int dense_retval = hllDenseAdd(hdr->registers, ele, elesize);
redisAssert(dense_retval == 1);
return dense_retval;
}
/* Compute SUM(2^-reg) in the sparse representation.
......
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