summaryrefslogtreecommitdiff
path: root/src/cluster.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-10-07 09:51:55 +0200
committerantirez <antirez@gmail.com>2014-10-07 09:51:55 +0200
commitedb3987a061a8425bac8afcffe66293cf819a54c (patch)
treeed58913794b42ec9aa15b5fcf1102cf13449daa8 /src/cluster.h
parente4b0c8ec50f2248286b770a655ea85d5cfcc79f4 (diff)
downloadredis-edb3987a061a8425bac8afcffe66293cf819a54c.tar.gz
Cluster: more chatty slaves when failover is stalled.
Diffstat (limited to 'src/cluster.h')
-rw-r--r--src/cluster.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cluster.h b/src/cluster.h
index 3287afe72..b05a30ded 100644
--- a/src/cluster.h
+++ b/src/cluster.h
@@ -62,6 +62,14 @@ typedef struct clusterLink {
#define nodeTimedOut(n) ((n)->flags & REDIS_NODE_PFAIL)
#define nodeFailed(n) ((n)->flags & REDIS_NODE_FAIL)
+/* Reasons why a slave is not able to failover. */
+#define REDIS_CLUSTER_CANT_FAILOVER_NONE 0
+#define REDIS_CLUSTER_CANT_FAILOVER_DATA_AGE 1
+#define REDIS_CLUSTER_CANT_FAILOVER_WAITING_DELAY 2
+#define REDIS_CLUSTER_CANT_FAILOVER_EXPIRED 3
+#define REDIS_CLUSTER_CANT_FAILOVER_WAITING_VOTES 4
+#define REDIS_CLUSTER_CANT_FAILOVER_RELOG_PERIOD (60*5) /* seconds. */
+
/* This structure represent elements of node->fail_reports. */
typedef struct clusterNodeFailReport {
struct clusterNode *node; /* Node reporting the failure condition. */
@@ -107,6 +115,8 @@ typedef struct clusterState {
int failover_auth_sent; /* True if we already asked for votes. */
int failover_auth_rank; /* This slave rank for current auth request. */
uint64_t failover_auth_epoch; /* Epoch of the current election. */
+ int cant_failover_reason; /* Why a slave is currently not able to
+ failover. See the CANT_FAILOVER_* macros. */
/* Manual failover state in common. */
mstime_t mf_end; /* Manual failover time limit (ms unixtime).
It is zero if there is no MF in progress. */