Skip to content

Commit

Permalink
Do not include gossip about receiver in cluster messages (redis#13046)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
srgsanky authored Feb 14, 2024
1 parent e9c795e commit c1d2ac2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,10 +2121,11 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {

/* Update our state accordingly to the gossip sections */
node = clusterLookupNode(g->nodename, CLUSTER_NAMELEN);
if (node) {
/* Ignore gossips about self. */
if (node && node != myself) {
/* We already know this node.
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 (clusterNodeAddFailureReport(node,sender)) {
serverLog(LL_VERBOSE,
Expand Down Expand Up @@ -2183,7 +2184,7 @@ void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
node->cport = ntohs(g->cport);
node->flags &= ~CLUSTER_NODE_NOADDR;
}
} else {
} else if (!node) {
/* 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.
* Note that we cannot simply start a handshake against
Expand Down Expand Up @@ -3605,8 +3606,10 @@ void clusterSendPing(clusterLink *link, int type) {
clusterNode *this = dictGetVal(de);

/* Don't include this node: the whole packet header is about us
* already, so we just gossip about other nodes. */
if (this == myself) continue;
* already, so we just gossip about other nodes.
* 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. */
if (this->flags & CLUSTER_NODE_PFAIL) continue;
Expand Down

0 comments on commit c1d2ac2

Please sign in to comment.