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
4ce6bff2
Commit
4ce6bff2
authored
Sep 19, 2018
by
antirez
Browse files
Module cluster flags: add hooks for NO_FAILOVER flag.
parent
2ba52889
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
4ce6bff2
...
@@ -3216,7 +3216,8 @@ void clusterHandleSlaveMigration(int max_slaves) {
...
@@ -3216,7 +3216,8 @@ void clusterHandleSlaveMigration(int max_slaves) {
* the natural slaves of this instance to advertise their switch from
* the natural slaves of this instance to advertise their switch from
* the old master to the new one. */
* the old master to the new one. */
if
(
target
&&
candidate
==
myself
&&
if
(
target
&&
candidate
==
myself
&&
(
mstime
()
-
target
->
orphaned_time
)
>
CLUSTER_SLAVE_MIGRATION_DELAY
)
(
mstime
()
-
target
->
orphaned_time
)
>
CLUSTER_SLAVE_MIGRATION_DELAY
&&
!
(
server
.
cluster_module_flags
&
CLUSTER_MODULE_FLAG_NO_FAILOVER
))
{
{
serverLog
(
LL_WARNING
,
"Migrating to orphaned master %.40s"
,
serverLog
(
LL_WARNING
,
"Migrating to orphaned master %.40s"
,
target
->
name
);
target
->
name
);
...
@@ -3569,7 +3570,8 @@ void clusterCron(void) {
...
@@ -3569,7 +3570,8 @@ void clusterCron(void) {
if
(
nodeIsSlave
(
myself
))
{
if
(
nodeIsSlave
(
myself
))
{
clusterHandleManualFailover
();
clusterHandleManualFailover
();
clusterHandleSlaveFailover
();
if
(
!
(
server
.
cluster_module_flags
&
CLUSTER_MODULE_FLAG_NO_FAILOVER
))
clusterHandleSlaveFailover
();
/* If there are orphaned slaves, and we are a slave among the masters
/* If there are orphaned slaves, and we are a slave among the masters
* with the max number of non-failing slaves, consider migrating to
* with the max number of non-failing slaves, consider migrating to
* the orphaned masters. Note that it does not make sense to try
* the orphaned masters. Note that it does not make sense to try
...
...
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