diff options
author | antirez <antirez@gmail.com> | 2014-04-16 09:05:42 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-04-16 15:26:28 +0200 |
commit | 469b7c51684a48fa8ed64916e5d158aa5e268f59 (patch) | |
tree | 6a4734eb1cb295ec06f0ade36c0b9b99cf0d2cf1 | |
parent | 614fcd491e50a0f95c08b72dc292c9cc53ba8a5a (diff) | |
download | redis-469b7c51684a48fa8ed64916e5d158aa5e268f59.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); } |