summaryrefslogtreecommitdiff
path: root/src/cluster.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-12-11 09:19:06 +0100
committerantirez <antirez@gmail.com>2015-12-11 09:19:06 +0100
commitadc2fe69934fae596aee29c49db6acdc203a62d9 (patch)
tree9fdcd83261636f0f60480e4029bd7c0e11e4e030 /src/cluster.h
parent41db54a5573a04d035156d3a42e30ae5bbce3230 (diff)
downloadredis-adc2fe69934fae596aee29c49db6acdc203a62d9.tar.gz
Cluster: replica migration with delay.
We wait a fixed amount of time (5 seconds currently) much greater than the usual Cluster node to node communication latency, before migrating. This way when a failover occurs, before detecting the new master as a target for migration, we give the time to its natural slaves (the slaves of the failed over master) to announce they switched to the new master, preventing an useless migration operation.
Diffstat (limited to 'src/cluster.h')
-rw-r--r--src/cluster.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cluster.h b/src/cluster.h
index e8f9bff71..08a11e9a3 100644
--- a/src/cluster.h
+++ b/src/cluster.h
@@ -23,6 +23,7 @@
#define CLUSTER_DEFAULT_MIGRATION_BARRIER 1
#define CLUSTER_MF_TIMEOUT 5000 /* Milliseconds to do a manual failover. */
#define CLUSTER_MF_PAUSE_MULT 2 /* Master pause manual failover mult. */
+#define CLUSTER_SLAVE_MIGRATION_DELAY 5000 /* Delay for slave migration. */
/* Redirection errors returned by getNodeByQuery(). */
#define CLUSTER_REDIR_NONE 0 /* Node can serve the request. */
@@ -93,6 +94,7 @@ typedef struct clusterNode {
mstime_t fail_time; /* Unix time when FAIL flag was set */
mstime_t voted_time; /* Last time we voted for a slave of this master */
mstime_t repl_offset_time; /* Unix time we received offset for this node */
+ mstime_t orphaned_time; /* Starting time of orphaned master condition */
long long repl_offset; /* Last known repl offset for this node. */
char ip[NET_IP_STR_LEN]; /* Latest known IP address of this node */
int port; /* Latest known port of this node */