summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-09-19 11:43:37 +0200
committerantirez <antirez@gmail.com>2018-09-19 11:43:37 +0200
commit777cc5b98738df0156b1c822d7fb7851b5ffb4a6 (patch)
treee3861171798a2390969f39eef26676d3baee657b
parentc202ba2b35100b557946d578d67085791997e2f0 (diff)
downloadredis-777cc5b98738df0156b1c822d7fb7851b5ffb4a6.tar.gz
Module cluster flags: add hooks for NO_FAILOVER flag.
-rw-r--r--src/cluster.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 591df418a..381ff827e 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -3216,7 +3216,8 @@ void clusterHandleSlaveMigration(int max_slaves) {
* the natural slaves of this instance to advertise their switch from
* the old master to the new one. */
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",
target->name);
@@ -3569,7 +3570,8 @@ void clusterCron(void) {
if (nodeIsSlave(myself)) {
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
* with the max number of non-failing slaves, consider migrating to
* the orphaned masters. Note that it does not make sense to try