mirror of
https://github.com/fluencelabs/redis
synced 2025-06-18 03:31:21 +00:00
On crash print information about the current client (if any), command vector, and object associated to first argument assuming it is a key.
This commit is contained in:
20
src/debug.c
20
src/debug.c
@ -336,9 +336,7 @@ void _redisAssertPrintClientInfo(redisClient *c) {
|
||||
}
|
||||
}
|
||||
|
||||
void _redisAssertPrintObject(robj *o) {
|
||||
bugReportStart();
|
||||
redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
|
||||
void redisLogObjectDebugInfo(robj *o) {
|
||||
redisLog(REDIS_WARNING,"Object type: %d", o->type);
|
||||
redisLog(REDIS_WARNING,"Object encoding: %d", o->encoding);
|
||||
redisLog(REDIS_WARNING,"Object refcount: %d", o->refcount);
|
||||
@ -346,9 +344,25 @@ void _redisAssertPrintObject(robj *o) {
|
||||
redisLog(REDIS_WARNING,"Object raw string len: %d", sdslen(o->ptr));
|
||||
if (sdslen(o->ptr) < 4096)
|
||||
redisLog(REDIS_WARNING,"Object raw string content: \"%s\"", (char*)o->ptr);
|
||||
} else if (o->type == REDIS_LIST) {
|
||||
redisLog(REDIS_WARNING,"List length: %d", (int) listTypeLength(o));
|
||||
} else if (o->type == REDIS_SET) {
|
||||
redisLog(REDIS_WARNING,"Set size: %d", (int) setTypeSize(o));
|
||||
} else if (o->type == REDIS_HASH) {
|
||||
redisLog(REDIS_WARNING,"Hash size: %d", (int) hashTypeLength(o));
|
||||
} else if (o->type == REDIS_ZSET) {
|
||||
redisLog(REDIS_WARNING,"Sorted set size: %d", (int) zsetLength(o));
|
||||
if (o->encoding == REDIS_ENCODING_SKIPLIST)
|
||||
redisLog(REDIS_WARNING,"Skiplist level: %d", (int) ((zset*)o->ptr)->zsl->level);
|
||||
}
|
||||
}
|
||||
|
||||
void _redisAssertPrintObject(robj *o) {
|
||||
bugReportStart();
|
||||
redisLog(REDIS_WARNING,"=== ASSERTION FAILED OBJECT CONTEXT ===");
|
||||
redisLogObjectDebugInfo(o);
|
||||
}
|
||||
|
||||
void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line) {
|
||||
if (c) _redisAssertPrintClientInfo(c);
|
||||
if (o) _redisAssertPrintObject(o);
|
||||
|
Reference in New Issue
Block a user