提交 07486df6 编写于 作者: A antirez

new INFO filed master_link_down_since_seconds

上级 591f29e0
......@@ -522,6 +522,7 @@ void freeClient(redisClient *c) {
if (c->flags & REDIS_MASTER) {
server.master = NULL;
server.replstate = REDIS_REPL_CONNECT;
server.repl_down_since = time(NULL);
/* Since we lost the connection with the master, we should also
* 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
......
......@@ -901,6 +901,7 @@ void initServerConfig() {
server.replstate = REDIS_REPL_NONE;
server.repl_syncio_timeout = REDIS_REPL_SYNCIO_TIMEOUT;
server.repl_serve_stale_data = 1;
server.repl_down_since = -1;
/* Double constants initialization */
R_Zero = 0.0;
......@@ -1522,6 +1523,12 @@ sds genRedisInfoString(char *section) {
(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,
"connected_slaves:%d\r\n",
......
......@@ -604,6 +604,7 @@ struct redisServer {
char *repl_transfer_tmpfile; /* slave-> master SYNC temp file name */
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? */
time_t repl_down_since; /* unix time at which link with master went down */
/* Limits */
unsigned int maxclients;
unsigned long long maxmemory;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册