mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 08:30:51 +00:00
number of keys info in INFO command thanks to Diego Rosario Brogna
This commit is contained in:
parent
7492bbe9f5
commit
c3cb078d46
2
TODO
2
TODO
@ -1,8 +1,6 @@
|
|||||||
BEFORE REDIS 1.0.0-rc1
|
BEFORE REDIS 1.0.0-rc1
|
||||||
|
|
||||||
* SPOP man page
|
|
||||||
* Add number of keys for every DB in INFO
|
* Add number of keys for every DB in INFO
|
||||||
* check 'server.dirty' everywere. Make it proprotional to the number of objects modified.
|
|
||||||
* Cover most of the source code with test-redis.tcl
|
* Cover most of the source code with test-redis.tcl
|
||||||
* Remove tmp-.... files when saving child exits in the wrong way, to do so use tmp-pid.rdb as filename so that the parent can rebuild the file name just from the child pid.
|
* Remove tmp-.... files when saving child exits in the wrong way, to do so use tmp-pid.rdb as filename so that the parent can rebuild the file name just from the child pid.
|
||||||
|
|
||||||
|
15
redis.c
15
redis.c
@ -734,8 +734,8 @@ static int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientD
|
|||||||
size = dictSlots(server.db[j].dict);
|
size = dictSlots(server.db[j].dict);
|
||||||
used = dictSize(server.db[j].dict);
|
used = dictSize(server.db[j].dict);
|
||||||
vkeys = dictSize(server.db[j].expires);
|
vkeys = dictSize(server.db[j].expires);
|
||||||
if (!(loops % 5) && used > 0) {
|
if (!(loops % 5) && (used || vkeys)) {
|
||||||
redisLog(REDIS_DEBUG,"DB %d: %d keys (%d volatile) in %d slots HT.",j,used,vkeys,size);
|
redisLog(REDIS_DEBUG,"DB %d: %lld keys (%lld volatile) in %lld slots HT.",j,used,vkeys,size);
|
||||||
/* dictPrintStats(server.dict); */
|
/* dictPrintStats(server.dict); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3602,6 +3602,7 @@ static void sortCommand(redisClient *c) {
|
|||||||
static void infoCommand(redisClient *c) {
|
static void infoCommand(redisClient *c) {
|
||||||
sds info;
|
sds info;
|
||||||
time_t uptime = time(NULL)-server.stat_starttime;
|
time_t uptime = time(NULL)-server.stat_starttime;
|
||||||
|
int j;
|
||||||
|
|
||||||
info = sdscatprintf(sdsempty(),
|
info = sdscatprintf(sdsempty(),
|
||||||
"redis_version:%s\r\n"
|
"redis_version:%s\r\n"
|
||||||
@ -3642,6 +3643,16 @@ static void infoCommand(redisClient *c) {
|
|||||||
(int)(time(NULL)-server.master->lastinteraction)
|
(int)(time(NULL)-server.master->lastinteraction)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
for (j = 0; j < server.dbnum; j++) {
|
||||||
|
long long keys, vkeys;
|
||||||
|
|
||||||
|
keys = dictSize(server.db[j].dict);
|
||||||
|
vkeys = dictSize(server.db[j].expires);
|
||||||
|
if (keys || vkeys) {
|
||||||
|
info = sdscatprintf(info, "db%d: keys=%lld,expires=%lld\r\n",
|
||||||
|
j, keys, vkeys);
|
||||||
|
}
|
||||||
|
}
|
||||||
addReplySds(c,sdscatprintf(sdsempty(),"$%d\r\n",sdslen(info)));
|
addReplySds(c,sdscatprintf(sdsempty(),"$%d\r\n",sdslen(info)));
|
||||||
addReplySds(c,info);
|
addReplySds(c,info);
|
||||||
addReply(c,shared.crlf);
|
addReply(c,shared.crlf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user