mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
PFDEBUG added, PFGETREG removed.
PFDEBUG will be the interface to do debugging tasks with a key containing an HLL object.
This commit is contained in:
parent
e8e717e145
commit
261da523e8
@ -1214,26 +1214,42 @@ cleanup:
|
|||||||
sdsfree(bitcounters);
|
sdsfree(bitcounters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PFGETREG
|
/* PFDEBUG <subcommand> <key> ... args ...
|
||||||
* Return the registers values of the specified HLL. */
|
* Different debugging related operations about the HLL implementation. */
|
||||||
void pfgetregCommand(redisClient *c) {
|
void pfdebugCommand(redisClient *c) {
|
||||||
robj *o = lookupKeyRead(c->db,c->argv[1]);
|
char *cmd = c->argv[1]->ptr;
|
||||||
struct hllhdr *hdr;
|
struct hllhdr *hdr;
|
||||||
|
robj *o;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
o = lookupKeyRead(c->db,c->argv[2]);
|
||||||
if (o == NULL) {
|
if (o == NULL) {
|
||||||
addReplyError(c,"The specified key does not exist");
|
addReplyError(c,"The specified key does not exist");
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
if (isHLLObjectOrReply(c,o) != REDIS_OK) return;
|
if (isHLLObjectOrReply(c,o) != REDIS_OK) return;
|
||||||
|
o = dbUnshareStringValue(c->db,c->argv[2],o);
|
||||||
|
hdr = o->ptr;
|
||||||
|
|
||||||
|
/* PFDEBUG GETREG <key> */
|
||||||
|
if (!strcasecmp(cmd,"getreg")) {
|
||||||
|
if (c->argc != 3) goto arityerr;
|
||||||
|
|
||||||
hdr = o->ptr;
|
|
||||||
addReplyMultiBulkLen(c,HLL_REGISTERS);
|
addReplyMultiBulkLen(c,HLL_REGISTERS);
|
||||||
|
hllSparseToDense(o);
|
||||||
for (j = 0; j < HLL_REGISTERS; j++) {
|
for (j = 0; j < HLL_REGISTERS; j++) {
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
|
|
||||||
HLL_DENSE_GET_REGISTER(val,hdr->registers,j);
|
HLL_DENSE_GET_REGISTER(val,hdr->registers,j);
|
||||||
addReplyLongLong(c,val);
|
addReplyLongLong(c,val);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
addReplyErrorFormat(c,"Unknown PFDEBUG subcommand '%s'", cmd);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
arityerr:
|
||||||
|
addReplyErrorFormat(c,
|
||||||
|
"Wrong number of arguments for the '%s' subcommand",cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ struct redisCommand redisCommandTable[] = {
|
|||||||
{"pfadd",pfaddCommand,-2,"wm",0,NULL,1,1,1,0,0},
|
{"pfadd",pfaddCommand,-2,"wm",0,NULL,1,1,1,0,0},
|
||||||
{"pfcount",pfcountCommand,2,"w",0,NULL,1,1,1,0,0},
|
{"pfcount",pfcountCommand,2,"w",0,NULL,1,1,1,0,0},
|
||||||
{"pfmerge",pfmergeCommand,-2,"wm",0,NULL,1,-1,1,0,0},
|
{"pfmerge",pfmergeCommand,-2,"wm",0,NULL,1,-1,1,0,0},
|
||||||
{"pfgetreg",pfgetregCommand,2,"r",0,NULL,0,0,0,0,0}
|
{"pfdebug",pfdebugCommand,-3,"r",0,NULL,0,0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct evictionPoolEntry *evictionPoolAlloc(void);
|
struct evictionPoolEntry *evictionPoolAlloc(void);
|
||||||
|
@ -1460,7 +1460,7 @@ void pfselftestCommand(redisClient *c);
|
|||||||
void pfaddCommand(redisClient *c);
|
void pfaddCommand(redisClient *c);
|
||||||
void pfcountCommand(redisClient *c);
|
void pfcountCommand(redisClient *c);
|
||||||
void pfmergeCommand(redisClient *c);
|
void pfmergeCommand(redisClient *c);
|
||||||
void pfgetregCommand(redisClient *c);
|
void pfdebugCommand(redisClient *c);
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
void *calloc(size_t count, size_t size) __attribute__ ((deprecated));
|
void *calloc(size_t count, size_t size) __attribute__ ((deprecated));
|
||||||
|
Loading…
Reference in New Issue
Block a user