Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
32bba43a
Commit
32bba43a
authored
Dec 11, 2014
by
Matt Stancliff
Browse files
Add 'age' value to SENTINEL INFO-CACHE
parent
5888290d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
32bba43a
...
@@ -2784,6 +2784,7 @@ void sentinelCommand(redisClient *c) {
...
@@ -2784,6 +2784,7 @@ void sentinelCommand(redisClient *c) {
sentinelSetCommand
(
c
);
sentinelSetCommand
(
c
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"info-cache"
))
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"info-cache"
))
{
if
(
c
->
argc
<
2
)
goto
numargserr
;
if
(
c
->
argc
<
2
)
goto
numargserr
;
mstime_t
now
=
mstime
();
/* Create an ad-hoc dictionary type so that we can iterate
/* Create an ad-hoc dictionary type so that we can iterate
* a dictionary composed of just the master groups the user
* a dictionary composed of just the master groups the user
...
@@ -2819,6 +2820,8 @@ void sentinelCommand(redisClient *c) {
...
@@ -2819,6 +2820,8 @@ void sentinelCommand(redisClient *c) {
sentinelRedisInstance
*
ri
=
dictGetVal
(
de
);
sentinelRedisInstance
*
ri
=
dictGetVal
(
de
);
addReplyBulkCBuffer
(
c
,
ri
->
name
,
strlen
(
ri
->
name
));
addReplyBulkCBuffer
(
c
,
ri
->
name
,
strlen
(
ri
->
name
));
addReplyMultiBulkLen
(
c
,
dictSize
(
ri
->
slaves
)
+
1
);
/* +1 for self */
addReplyMultiBulkLen
(
c
,
dictSize
(
ri
->
slaves
)
+
1
);
/* +1 for self */
addReplyMultiBulkLen
(
c
,
2
);
addReplyLongLong
(
c
,
now
-
ri
->
info_refresh
);
if
(
ri
->
info
)
if
(
ri
->
info
)
addReplyBulkCBuffer
(
c
,
ri
->
info
,
sdslen
(
ri
->
info
));
addReplyBulkCBuffer
(
c
,
ri
->
info
,
sdslen
(
ri
->
info
));
else
else
...
@@ -2829,6 +2832,8 @@ void sentinelCommand(redisClient *c) {
...
@@ -2829,6 +2832,8 @@ void sentinelCommand(redisClient *c) {
sdi
=
dictGetIterator
(
ri
->
slaves
);
sdi
=
dictGetIterator
(
ri
->
slaves
);
while
((
sde
=
dictNext
(
sdi
))
!=
NULL
)
{
while
((
sde
=
dictNext
(
sdi
))
!=
NULL
)
{
sentinelRedisInstance
*
sri
=
dictGetVal
(
sde
);
sentinelRedisInstance
*
sri
=
dictGetVal
(
sde
);
addReplyMultiBulkLen
(
c
,
2
);
addReplyLongLong
(
c
,
now
-
sri
->
info_refresh
);
if
(
sri
->
info
)
if
(
sri
->
info
)
addReplyBulkCBuffer
(
c
,
sri
->
info
,
sdslen
(
sri
->
info
));
addReplyBulkCBuffer
(
c
,
sri
->
info
,
sdslen
(
sri
->
info
));
else
else
...
...
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