Skip to content

Commit

Permalink
Make a light weight version of DEBUG OBJECT, add FAST option (valkey-…
Browse files Browse the repository at this point in the history
…io#881)

Adding FAST option to DEBUG OBJECT command.

The light version only shows the light weight infomation,
which mostly O(1). The pre-existing version that show more
stats such as serializedlength sometimes is time consuming.

This should allow looking into debug stats (the key expired
but not deleted), even on huge object, on which we're afraid
to run the command for fear of causing a server freeze.

Somehow like 3ca451c.

Signed-off-by: Binbin <binloveplay1314@qq.com>
Signed-off-by: Ping Xie <pingxie@google.com>
  • Loading branch information
PingXie committed Sep 14, 2024
1 parent 3b4b8b2 commit 622e831
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,7 @@ void debugCommand(client *c) {
sds s = sdsempty();
s = sdscatprintf(s, "Value at:%p refcount:%d encoding:%s", (void *)val, val->refcount, strenc);
if (!fast) s = sdscatprintf(s, " serializedlength:%zu", rdbSavedObjectLen(val, c->argv[2], c->db->id));
/* Either lru or lfu field could work correctly which depends on server.maxmemory_policy. */
s = sdscatprintf(s, " lru:%d lru_seconds_idle:%llu", val->lru, estimateObjectIdleTime(val) / 1000);
s = sdscatprintf(s, " lfu_freq:%lu lfu_access_time_minutes:%u", LFUDecrAndReturn(val), val->lru >> 8);
s = sdscatprintf(s, "%s", extra);
addReplyStatusLength(c, s, sdslen(s));
sdsfree(s);
Expand Down

0 comments on commit 622e831

Please sign in to comment.