Skip to content

Commit

Permalink
Update comments and log message in cluster_legacy.c
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Turin <[email protected]>
  • Loading branch information
pieturin committed Jan 14, 2025
1 parent c5a1585 commit d5cb962
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3278,8 +3278,8 @@ int clusterProcessPacket(clusterLink *link) {
/* Unable to retrieve the node's IP address from the connection. Without a
* valid IP, the node becomes unusable in the cluster. This failure might be
* due to the connection being closed. */
serverLog(LL_NOTICE, "Closing link even though we received a MEET packet on it, "
"because the connection has an error");
serverLog(LL_NOTICE, "Closing cluster link due to failure to retrieve IP from the connection, "
"possibly caused by a closed connection.");
freeClusterLink(link);
return 0;
}
Expand All @@ -3302,14 +3302,14 @@ int clusterProcessPacket(clusterLink *link) {
clusterAddNode(node);
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG);
} else {
/* A second MEET packet was received on an existing link during the handshake process.
* This happens when the other node detects no inbound link, and re-sends a MEET packet
* before this node can respond with a PING. This MEET is a no-op.
/* A second MEET packet was received on an existing link during the handshake
* process. This happens when the other node detects no inbound link, and
* re-sends a MEET packet before this node can respond with a PING.
* This MEET is a no-op.
*
* Note: Nodes in HANDSHAKE state are not fully "known" (random names), so the sender
* remains unidentified at this point. The MEET packet might be re-sent if the inbound
* connection is still unestablished by the next cron cycle.
*/
* Note: Nodes in HANDSHAKE state are not fully "known" (random names), so the
* sender remains unidentified at this point. The MEET packet might be re-sent
* if the inbound connection is still unestablished by the next cron cycle. */
debugServerAssert(link->inbound && nodeInHandshake(link->node));
}

Expand All @@ -3318,12 +3318,14 @@ int clusterProcessPacket(clusterLink *link) {
* of the message type. */
clusterProcessGossipSection(hdr, link);
} else if (sender->link && nodeExceedsHandshakeTimeout(sender, now)) {
/* The MEET packet is from a known node, after the handshake timeout, so the sender thinks that I do not
* know it.
* Free my outbound link to that node, triggering a reconnect and a PING over the new link.
* Once that node receives our PING, it should recognize the new connection as an inbound link from me.
* We should only free the outbound link if the node is known for more time than the handshake timeout,
* since during this time, the other side might still be trying to complete the handshake. */
/* The MEET packet is from a known node, after the handshake timeout, so the sender
* thinks that I do not know it.
* Free my outbound link to that node, triggering a reconnect and a PING over the
* new link.
* Once that node receives our PING, it should recognize the new connection as an
* inbound link from me. We should only free the outbound link if the node is known
* for more time than the handshake timeout, since during this time, the other side
* might still be trying to complete the handshake. */

/* We should always receive a MEET packet on an inbound link. */
serverAssert(link != sender->link);
Expand Down

0 comments on commit d5cb962

Please sign in to comment.