summaryrefslogtreecommitdiff
path: root/src/cluster.h
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-01-28 16:28:07 +0100
committerantirez <antirez@gmail.com>2014-01-28 16:28:07 +0100
commit0b1b25c51cb6e4ed4469d413284d2a8a9051cf0d (patch)
treed0fac8186e81b9250cb14785e3b47e6438085ee7 /src/cluster.h
parent72f1715e45c8e8418e158fb676b7e491d51ab9e7 (diff)
downloadredis-0b1b25c51cb6e4ed4469d413284d2a8a9051cf0d.tar.gz
Cluster: introduced repl_offset fields in clusterNode.
The two fields are used in order to remember the latest known replication offset and the time we received it from other slave nodes. This will be used by slaves in order to start the election procedure with a delay that is proportional to the rank of the slave among the other slaves for this master, when sorted for replication offset. Usually this allows the slave with the most updated offset to win the election and replace the failing master in the cluster.
Diffstat (limited to 'src/cluster.h')
-rw-r--r--src/cluster.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cluster.h b/src/cluster.h
index faba13477..673643686 100644
--- a/src/cluster.h
+++ b/src/cluster.h
@@ -61,10 +61,12 @@ struct clusterNode {
int numslaves; /* Number of slave nodes, if this is a master */
struct clusterNode **slaves; /* pointers to slave nodes */
struct clusterNode *slaveof; /* pointer to the master node */
- mstime_t ping_sent; /* Unix time we sent latest ping */
- mstime_t pong_received; /* Unix time we received the pong */
- 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 ping_sent; /* Unix time we sent latest ping */
+ mstime_t pong_received; /* Unix time we received the pong */
+ 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 */
+ long long repl_offset; /* Last known repl offset for this node. */
char ip[REDIS_IP_STR_LEN]; /* Latest known IP address of this node */
int port; /* Latest known port of this node */
clusterLink *link; /* TCP/IP link with this node */