diff options
author | antirez <antirez@gmail.com> | 2014-04-16 09:05:42 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-04-16 15:09:47 +0200 |
commit | 030336d4ef4b2f6b4a395267a775785066b6b8d4 (patch) | |
tree | d446680cd6046035dab0e6d1b3a3c65e120a1660 | |
parent | e4c2afb9c02215a645666c3a3e1fdff70e628ebd (diff) | |
download | redis-030336d4ef4b2f6b4a395267a775785066b6b8d4.tar.gz |
PFDEBUG TODENSE added.
Converts HyperLogLogs from sparse to dense. Used for testing.
-rw-r--r-- | src/hyperloglog.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/hyperloglog.c b/src/hyperloglog.c index bb07aa380..3cb31f296 100644 --- a/src/hyperloglog.c +++ b/src/hyperloglog.c @@ -1427,6 +1427,21 @@ void pfdebugCommand(redisClient *c) { if (c->argc != 3) goto arityerr; addReplyStatus(c,encodingstr[hdr->encoding]); + } + /* PFDEBUG TODENSE <key> */ + else if (!strcasecmp(cmd,"todense")) { + int conv = 0; + if (c->argc != 3) goto arityerr; + + if (hdr->encoding == HLL_SPARSE) { + if (hllSparseToDense(o) == REDIS_ERR) { + addReplyError(c,invalid_hll_err); + return; + } + conv = 1; + server.dirty++; /* Force propagation on encoding change. */ + } + addReply(c,conv ? shared.cone : shared.czero); } else { addReplyErrorFormat(c,"Unknown PFDEBUG subcommand '%s'", cmd); } |