diff options
author | antirez <antirez@gmail.com> | 2014-04-14 09:36:27 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-04-16 15:26:27 +0200 |
commit | 91391760ca13cc2f6cc88e49f68093f228193f6d (patch) | |
tree | 1c123e425957e6e4ce7aaa4d58fa9fc5d1b674cf | |
parent | 5d87160f8a30eae9f9090b8709c0774042d3a618 (diff) | |
download | redis-91391760ca13cc2f6cc88e49f68093f228193f6d.tar.gz |
hllSparseAdd(): more correct dense conversion conditional.
We want to promote if the total string size exceeds the resulting size
after the upgrade.
-rw-r--r-- | src/hyperloglog.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c index 38495a0b3..df79fc970 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -801,7 +801,7 @@ int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) { int oldlen = is_xzero ? 2 : 1; int deltalen = seqlen-oldlen; - if (deltalen > 0 && sdslen(o->ptr) > HLL_SPARSE_MAX) goto promote; + if (deltalen > 0 && sdslen(o->ptr)+deltalen > HLL_SPARSE_MAX) goto promote; if (deltalen && next) memmove(next+deltalen,next,next-sparse); sdsIncrLen(o->ptr,deltalen); memcpy(p,seq,seqlen); |