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
59ff2fe9
Commit
59ff2fe9
authored
Apr 30, 2013
by
antirez
Browse files
Sentinel: more sensible delay in master demote after tilt.
parent
fb0d08e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/sentinel.c
View file @
59ff2fe9
...
@@ -1481,18 +1481,20 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
...
@@ -1481,18 +1481,20 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
if
(
ri
->
flags
&
SRI_DEMOTE
)
{
if
(
ri
->
flags
&
SRI_DEMOTE
)
{
/* If this sentinel was partitioned from the slave's master,
/* If this sentinel was partitioned from the slave's master,
* or tilted recently, wait some time before to act,
* or tilted recently, wait some time before to act,
* so that DOWN and roles
info
will be refreshed. */
* so that DOWN and roles
INFO
will be refreshed. */
if
(
!
sentinelRedisInstanceNoDownFor
(
ri
->
master
,
mstime_t
wait_time
=
SENTINEL_INFO_PERIOD
*
2
+
SENTINEL_INFO_PERIOD
*
2
))
ri
->
master
->
down_after_period
*
2
;
return
;
if
(
mstime
()
-
sentinel
.
tilt_star
t_time
<
if
(
!
sentinelRedisInstanceNoDownFor
(
ri
->
master
,
wai
t_time
)
||
SENTINEL_TILT_PERIOD
+
ri
->
master
->
down_after_period
*
2
)
(
mstime
()
-
sentinel
.
tilt_start_time
)
<
wait_time
)
return
;
return
;
/* Old master returned back? Turn it into a slave ASAP if:
/* Old master returned back? Turn it into a slave ASAP if
* we can reach what we believe is the new master now, and
* have a recent role information for it.
*
*
*
W
e'll clear th
is
flag only when we have the
acknowledge
*
Note: w
e'll clear th
e DEMOTE
flag only when we have the
* that it's a slave again. */
*
acknowledge
that it's a slave again. */
if
(
ri
->
master
->
flags
&
SRI_MASTER
&&
if
(
ri
->
master
->
flags
&
SRI_MASTER
&&
(
ri
->
master
->
flags
&
(
SRI_S_DOWN
|
SRI_O_DOWN
))
==
0
&&
(
ri
->
master
->
flags
&
(
SRI_S_DOWN
|
SRI_O_DOWN
))
==
0
&&
(
mstime
()
-
ri
->
master
->
info_refresh
)
<
SENTINEL_INFO_PERIOD
*
2
)
(
mstime
()
-
ri
->
master
->
info_refresh
)
<
SENTINEL_INFO_PERIOD
*
2
)
...
...
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