From ace065423e275013f334ac8c40a96cb173c6897e Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 7 Jan 2010 16:51:58 -0500 Subject: [PATCH] Now DEBUG OBJECT plays well with swapped out objects --- redis.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/redis.c b/redis.c index f172f144..7caa8103 100644 --- a/redis.c +++ b/redis.c @@ -7175,10 +7175,19 @@ static void debugCommand(redisClient *c) { } key = dictGetEntryKey(de); val = dictGetEntryVal(de); - addReplySds(c,sdscatprintf(sdsempty(), - "+Key at:%p refcount:%d, value at:%p refcount:%d encoding:%d serializedlength:%lld\r\n", + if (server.vm_enabled && key->storage == REDIS_VM_MEMORY) { + addReplySds(c,sdscatprintf(sdsempty(), + "+Key at:%p refcount:%d, value at:%p refcount:%d " + "encoding:%d serializedlength:%lld\r\n", (void*)key, key->refcount, (void*)val, val->refcount, val->encoding, rdbSavedObjectLen(val))); + } else { + addReplySds(c,sdscatprintf(sdsempty(), + "+Key at:%p refcount:%d, value swapped at: page %llu " + "using %llu pages\r\n", + (void*)key, key->refcount, (unsigned long long) key->vm.page, + (unsigned long long) key->vm.usedpages)); + } } else if (!strcasecmp(c->argv[1]->ptr,"swapout") && c->argc == 3) { dictEntry *de = dictFind(c->db->dict,c->argv[2]); robj *key, *val; -- GitLab