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
e10ee072
Commit
e10ee072
authored
May 12, 2014
by
antirez
Browse files
Cluster: fixed data_age computation / check integer overflow.
parent
e84dcabf
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
e10ee072
...
...
@@ -2318,9 +2318,10 @@ void clusterHandleSlaveFailover(void) {
/* 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
)
*
1000
;
data_age
=
(
mstime_t
)(
server
.
unixtime
-
server
.
master
->
lastinteraction
)
*
1000
;
}
else
{
data_age
=
(
server
.
unixtime
-
server
.
repl_down_since
)
*
1000
;
data_age
=
(
mstime_t
)
(
server
.
unixtime
-
server
.
repl_down_since
)
*
1000
;
}
/* Remove the node timeout from the data age as it is fine that we are
...
...
@@ -2335,7 +2336,7 @@ void clusterHandleSlaveFailover(void) {
*
* Check bypassed for manual failovers. */
if
(
data_age
>
(
server
.
repl_ping_slave_period
*
1000
)
+
(
(
mstime_t
)
server
.
repl_ping_slave_period
*
1000
)
+
(
server
.
cluster_node_timeout
*
REDIS_CLUSTER_SLAVE_VALIDITY_MULT
))
{
if
(
!
manual_failover
)
return
;
...
...
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