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
f7d6ad43
Commit
f7d6ad43
authored
Oct 07, 2013
by
antirez
Browse files
Cluster: fix slave data age computation when master is still connected.
parent
2c3301b9
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
f7d6ad43
...
...
@@ -1607,11 +1607,18 @@ void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *request) {
* 3) Perform the failover informing all the other nodes.
*/
void clusterHandleSlaveFailover(void) {
time_t data_age
= server.unixtime - server.repl_down_since
;
time_t data_age;
mstime_t auth_age = mstime() - server.cluster->failover_auth_time;
int needed_quorum = (server.cluster->size / 2) + 1;
int j;
/* Set data_age to the number of seconds we are disconnected from the master. */
if (server.repl_state == REDIS_REPL_CONNECTED) {
data_age = server.unixtime - server.master->lastinteraction;
} else {
data_age = server.unixtime - server.repl_down_since;
}
/* Pre conditions to run the function:
* 1) We are a slave.
* 2) Our master is flagged as FAIL.
...
...
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