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.
This commit is contained in:
antirez
2014-01-28 16:28:07 +01:00
parent 72f1715e45
commit 0b1b25c51c
2 changed files with 8 additions and 4 deletions

View File

@ -440,6 +440,8 @@ clusterNode *createClusterNode(char *nodename, int flags) {
node->port = 0;
node->fail_reports = listCreate();
node->voted_time = 0;
node->repl_offset_time = 0;
node->repl_offset = 0;
listSetFreeMethod(node->fail_reports,zfree);
return node;
}