Skip to content

Commit

Permalink
PFDEBUG TODENSE added.
Browse files Browse the repository at this point in the history
Converts HyperLogLogs from sparse to dense. Used for testing.
  • Loading branch information
antirez committed Apr 16, 2014
1 parent 402110f commit 0bbdaca
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/hyperloglog.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 0bbdaca

Please sign in to comment.