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
07486df6
Commit
07486df6
authored
Jun 17, 2011
by
antirez
Browse files
new INFO filed master_link_down_since_seconds
parent
591f29e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
07486df6
...
@@ -522,6 +522,7 @@ void freeClient(redisClient *c) {
...
@@ -522,6 +522,7 @@ void freeClient(redisClient *c) {
if
(
c
->
flags
&
REDIS_MASTER
)
{
if
(
c
->
flags
&
REDIS_MASTER
)
{
server
.
master
=
NULL
;
server
.
master
=
NULL
;
server
.
replstate
=
REDIS_REPL_CONNECT
;
server
.
replstate
=
REDIS_REPL_CONNECT
;
server
.
repl_down_since
=
time
(
NULL
);
/* Since we lost the connection with the master, we should also
/* Since we lost the connection with the master, we should also
* close the connection with all our slaves if we have any, so
* close the connection with all our slaves if we have any, so
* when we'll resync with the master the other slaves will sync again
* when we'll resync with the master the other slaves will sync again
...
...
src/redis.c
View file @
07486df6
...
@@ -901,6 +901,7 @@ void initServerConfig() {
...
@@ -901,6 +901,7 @@ void initServerConfig() {
server
.
replstate
=
REDIS_REPL_NONE
;
server
.
replstate
=
REDIS_REPL_NONE
;
server
.
repl_syncio_timeout
=
REDIS_REPL_SYNCIO_TIMEOUT
;
server
.
repl_syncio_timeout
=
REDIS_REPL_SYNCIO_TIMEOUT
;
server
.
repl_serve_stale_data
=
1
;
server
.
repl_serve_stale_data
=
1
;
server
.
repl_down_since
=
-
1
;
/* Double constants initialization */
/* Double constants initialization */
R_Zero
=
0
.
0
;
R_Zero
=
0
.
0
;
...
@@ -1522,6 +1523,12 @@ sds genRedisInfoString(char *section) {
...
@@ -1522,6 +1523,12 @@ sds genRedisInfoString(char *section) {
(
int
)(
time
(
NULL
)
-
server
.
repl_transfer_lastio
)
(
int
)(
time
(
NULL
)
-
server
.
repl_transfer_lastio
)
);
);
}
}
if
(
server
.
replstate
!=
REDIS_REPL_CONNECTED
)
{
info
=
sdscatprintf
(
info
,
"master_link_down_since_seconds:%ld
\r\n
"
,
(
long
)
time
(
NULL
)
-
server
.
repl_down_since
);
}
}
}
info
=
sdscatprintf
(
info
,
info
=
sdscatprintf
(
info
,
"connected_slaves:%d
\r\n
"
,
"connected_slaves:%d
\r\n
"
,
...
...
src/redis.h
View file @
07486df6
...
@@ -604,6 +604,7 @@ struct redisServer {
...
@@ -604,6 +604,7 @@ struct redisServer {
char
*
repl_transfer_tmpfile
;
/* slave-> master SYNC temp file name */
char
*
repl_transfer_tmpfile
;
/* slave-> master SYNC temp file name */
time_t
repl_transfer_lastio
;
/* unix time of the latest read, for timeout */
time_t
repl_transfer_lastio
;
/* unix time of the latest read, for timeout */
int
repl_serve_stale_data
;
/* Serve stale data when link is down? */
int
repl_serve_stale_data
;
/* Serve stale data when link is down? */
time_t
repl_down_since
;
/* unix time at which link with master went down */
/* Limits */
/* Limits */
unsigned
int
maxclients
;
unsigned
int
maxclients
;
unsigned
long
long
maxmemory
;
unsigned
long
long
maxmemory
;
...
...
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