Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
46bd13b8
Commit
46bd13b8
authored
Feb 24, 2015
by
Salvatore Sanfilippo
Browse files
Merge pull request #1966 from mattsta/fix-sentinel-info
Sentinel: Improve INFO command behavior
parents
3689a058
391fc9b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
46bd13b8
...
@@ -2856,24 +2856,30 @@ numargserr:
...
@@ -2856,24 +2856,30 @@ numargserr:
/* SENTINEL INFO [section] */
/* SENTINEL INFO [section] */
void
sentinelInfoCommand
(
redisClient
*
c
)
{
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
)
{
if
(
c
->
argc
>
2
)
{
addReply
(
c
,
shared
.
syntaxerr
);
addReply
(
c
,
shared
.
syntaxerr
);
return
;
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
"
);
if
(
sections
++
)
info
=
sdscat
(
info
,
"
\r\n
"
);
sds
serversection
=
genRedisInfoString
(
"server"
);
sds
serversection
=
genRedisInfoString
(
"server"
);
info
=
sdscatlen
(
info
,
serversection
,
sdslen
(
serversection
));
info
=
sdscatlen
(
info
,
serversection
,
sdslen
(
serversection
));
sdsfree
(
serversection
);
sdsfree
(
serversection
);
}
}
if
(
!
strcasecmp
(
section
,
"sentinel"
)
||
defsections
)
{
if
(
defsections
||
allsections
||
!
strcasecmp
(
section
,
"sentinel"
))
{
dictIterator
*
di
;
dictIterator
*
di
;
dictEntry
*
de
;
dictEntry
*
de
;
int
master_id
=
0
;
int
master_id
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment