Unverified Commit c1d2ac2a authored by Sankar's avatar Sankar Committed by GitHub
Browse files

Do not include gossip about receiver in cluster messages (#13046)

The receiver does not update any of its cluster state based on gossip
about itself. This commit explicitly avoids sending or processing gossip
about the receiver.

Currently cluster bus gossips include 10% of nodes in the cluster with a
minimum of 3 nodes. For up to 30 node clusters, this commit makes sure
that 1/3 of the gossip (1 out of 3 gossips) is never discarded. This
should help with relatively faster convergence of cluster state in
general.
parent e9c795e7
...@@ -2121,10 +2121,11 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { ...@@ -2121,10 +2121,11 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
/* Update our state accordingly to the gossip sections */ /* Update our state accordingly to the gossip sections */
node = clusterLookupNode(g->nodename, CLUSTER_NAMELEN); node = clusterLookupNode(g->nodename, CLUSTER_NAMELEN);
if (node) { /* Ignore gossips about self. */
if (node && node != myself) {
/* We already know this node. /* We already know this node.
Handle failure reports, only when the sender is a master. */ Handle failure reports, only when the sender is a master. */
if (sender && clusterNodeIsMaster(sender) && node != myself) { if (sender && clusterNodeIsMaster(sender)) {
if (flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL)) { if (flags & (CLUSTER_NODE_FAIL|CLUSTER_NODE_PFAIL)) {
if (clusterNodeAddFailureReport(node,sender)) { if (clusterNodeAddFailureReport(node,sender)) {
serverLog(LL_VERBOSE, serverLog(LL_VERBOSE,
...@@ -2183,7 +2184,7 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) { ...@@ -2183,7 +2184,7 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
node->cport = ntohs(g->cport); node->cport = ntohs(g->cport);
node->flags &= ~CLUSTER_NODE_NOADDR; node->flags &= ~CLUSTER_NODE_NOADDR;
} }
} else { } else if (!node) {
/* If it's not in NOADDR state and we don't have it, we /* If it's not in NOADDR state and we don't have it, we
* add it to our trusted dict with exact nodeid and flag. * add it to our trusted dict with exact nodeid and flag.
* Note that we cannot simply start a handshake against * Note that we cannot simply start a handshake against
...@@ -3605,8 +3606,10 @@ void clusterSendPing(clusterLink *link, int type) { ...@@ -3605,8 +3606,10 @@ void clusterSendPing(clusterLink *link, int type) {
clusterNode *this = dictGetVal(de); clusterNode *this = dictGetVal(de);
/* Don't include this node: the whole packet header is about us /* Don't include this node: the whole packet header is about us
* already, so we just gossip about other nodes. */ * already, so we just gossip about other nodes.
if (this == myself) continue; * Also, don't include the receiver. Receiver will not update its state
* based on gossips about itself. */
if (this == myself || this == link->node) continue;
/* PFAIL nodes will be added later. */ /* PFAIL nodes will be added later. */
if (this->flags & CLUSTER_NODE_PFAIL) continue; if (this->flags & CLUSTER_NODE_PFAIL) continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment