Cluster: introduced a failure reports system.

A §Redis Cluster node used to mark a node as failing when itself
detected a failure for that node, and a single acknowledge was received
about the possible failure state.

The new API will be used in order to possible to require that N other
nodes have a PFAIL or FAIL state for a given node for a node to set it
as failing.
This commit is contained in:
antirez
2013-02-22 17:43:35 +01:00
parent 36af851550
commit 974929770b
2 changed files with 72 additions and 1 deletions

View File

@ -543,6 +543,12 @@ typedef struct clusterLink {
#define REDIS_NODE_MEET 128 /* Send a MEET message to this node */
#define REDIS_NODE_NULL_NAME "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
/* This structure represent elements of node->fail_reports. */
struct clusterNodeFailReport {
struct clusterNode *node; /* Node reporting the failure condition. */
time_t time; /* Time of the last report from this node. */
} typedef clusterNodeFailReport;
struct clusterNode {
char name[REDIS_CLUSTER_NAMELEN]; /* Node name, hex string, sha1-size */
int flags; /* REDIS_NODE_... */
@ -557,6 +563,7 @@ struct clusterNode {
char ip[16]; /* Latest known IP address of this node */
int port; /* Latest known port of this node */
clusterLink *link; /* TCP/IP link with this node */
list *fail_reports; /* List of nodes signaling this as failing */
};
typedef struct clusterNode clusterNode;