mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
add DEBUG JEMALLC PURGE and JEMALLOC INFO cleanup
This commit is contained in:
parent
7ba90225a0
commit
f8909a2579
17
src/debug.c
17
src/debug.c
@ -250,11 +250,13 @@ void computeDatasetDigest(unsigned char *final) {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_JEMALLOC)
|
||||
void inputCatSds(void *result, const char *str) {
|
||||
/* result is actually a (sds *), so re-cast it here */
|
||||
sds *info = (sds *)result;
|
||||
*info = sdscat(*info, str);
|
||||
}
|
||||
#endif
|
||||
|
||||
void debugCommand(client *c) {
|
||||
if (!strcasecmp(c->argv[1]->ptr,"segfault")) {
|
||||
@ -397,6 +399,7 @@ void debugCommand(client *c) {
|
||||
snprintf(buf,sizeof(buf),"value:%lu",j);
|
||||
val = createStringObject(buf,strlen(buf));
|
||||
dbAdd(c->db,key,val);
|
||||
signalModifiedKey(c->db,key);
|
||||
decrRefCount(key);
|
||||
}
|
||||
addReply(c,shared.ok);
|
||||
@ -474,8 +477,20 @@ void debugCommand(client *c) {
|
||||
sds info = sdsempty();
|
||||
je_malloc_stats_print(inputCatSds, &info, NULL);
|
||||
addReplyBulkSds(c, info);
|
||||
} else if (!strcasecmp(c->argv[2]->ptr, "purge")) {
|
||||
char tmp[32];
|
||||
unsigned narenas = 0;
|
||||
size_t sz = sizeof(unsigned);
|
||||
if (!je_mallctl("arenas.narenas", &narenas, &sz, NULL, 0)) {
|
||||
sprintf(tmp, "arena.%d.purge", narenas);
|
||||
if (!je_mallctl(tmp, NULL, 0, NULL, 0)) {
|
||||
addReply(c, shared.ok);
|
||||
return;
|
||||
}
|
||||
}
|
||||
addReplyError(c, "Error purging dirty pages");
|
||||
} else {
|
||||
addReplyErrorFormat(c, "Valid jemalloc debug fields: info");
|
||||
addReplyErrorFormat(c, "Valid jemalloc debug fields: info, purge");
|
||||
}
|
||||
#else
|
||||
addReplyErrorFormat(c, "jemalloc support not available");
|
||||
|
@ -787,7 +787,7 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
|
||||
output_raw = 0;
|
||||
if (!strcasecmp(command,"info") ||
|
||||
(argc >= 2 && !strcasecmp(command,"debug") &&
|
||||
(!strcasecmp(argv[1],"jemalloc") ||
|
||||
((!strcasecmp(argv[1],"jemalloc") && !strcasecmp(argv[2],"info")) ||
|
||||
!strcasecmp(argv[1],"htstats"))) ||
|
||||
(argc == 2 && !strcasecmp(command,"cluster") &&
|
||||
(!strcasecmp(argv[1],"nodes") ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user