summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2015-02-24 17:20:09 +0100
committerSalvatore Sanfilippo <antirez@gmail.com>2015-02-24 17:20:09 +0100
commit46bd13b8062227b529c851bd2ee7431309fdcfbb (patch)
treeb332a2b8ef8b6798df1a16c4cd4c40bb3253bbf3
parent3689a0582bef619a574835044c68c05dd8bd13f7 (diff)
parent391fc9b6335329e513664c69bdc18865ab944beb (diff)
downloadredis-46bd13b8062227b529c851bd2ee7431309fdcfbb.tar.gz
Merge pull request #1966 from mattsta/fix-sentinel-info
Sentinel: Improve INFO command behavior
-rw-r--r--src/sentinel.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/sentinel.c b/src/sentinel.c
index c693a5862..7d174ac28 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -2856,24 +2856,30 @@ numargserr:
/* SENTINEL INFO [section] */
void sentinelInfoCommand(redisClient *c) {
- char *section = c->argc == 2 ? c->argv[1]->ptr : "default";
- sds info = sdsempty();
- int defsections = !strcasecmp(section,"default");
- int sections = 0;
-
if (c->argc > 2) {
addReply(c,shared.syntaxerr);
return;
}
- if (!strcasecmp(section,"server") || defsections) {
+ int defsections = 0, allsections = 0;
+ char *section = c->argc == 2 ? c->argv[1]->ptr : NULL;
+ if (section) {
+ allsections = !strcasecmp(section,"all");
+ defsections = !strcasecmp(section,"default");
+ } else {
+ defsections = 1;
+ }
+
+ int sections = 0;
+ sds info = sdsempty();
+ if (defsections || allsections || !strcasecmp(section,"server")) {
if (sections++) info = sdscat(info,"\r\n");
sds serversection = genRedisInfoString("server");
info = sdscatlen(info,serversection,sdslen(serversection));
sdsfree(serversection);
}
- if (!strcasecmp(section,"sentinel") || defsections) {
+ if (defsections || allsections || !strcasecmp(section,"sentinel")) {
dictIterator *di;
dictEntry *de;
int master_id = 0;