Skip to content

Commit affbea5

Browse files
bentottenBen Totten
andauthored
For MEETs, save the extensions support flag immediately during MEET processing (#778)
For backwards compatibility reasons, a node will wait until it receives a cluster message with the extensions flag before sending its own extensions. This leads to a delay in shard ID propagation that can corrupt nodes.conf with inaccurate shard IDs if a node is restarted before this can stabilize. This fixes much of that delay by immediately triggering the extensions-supported flag during the MEET processing and attaching the node to the link, allowing the PONG reply to contain OSS extensions. Partially fixes #774 --------- Signed-off-by: Ben Totten <[email protected]> Co-authored-by: Ben Totten <[email protected]>
1 parent 50c1fe5 commit affbea5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cluster_legacy.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3156,14 +3156,21 @@ int clusterProcessPacket(clusterLink *link) {
31563156
/* Add this node if it is new for us and the msg type is MEET.
31573157
* In this stage we don't try to add the node with the right
31583158
* flags, replicaof pointer, and so forth, as this details will be
3159-
* resolved when we'll receive PONGs from the node. */
3159+
* resolved when we'll receive PONGs from the node. The exception
3160+
* to this is the flag that indicates extensions are supported, as
3161+
* we want to send extensions right away in the return PONG in order
3162+
* to reduce the amount of time needed to stabilize the shard ID. */
31603163
if (!sender && type == CLUSTERMSG_TYPE_MEET) {
31613164
clusterNode *node;
31623165

31633166
node = createClusterNode(NULL, CLUSTER_NODE_HANDSHAKE);
31643167
serverAssert(nodeIp2String(node->ip, link, hdr->myip) == C_OK);
31653168
getClientPortFromClusterMsg(hdr, &node->tls_port, &node->tcp_port);
31663169
node->cport = ntohs(hdr->cport);
3170+
if (hdr->mflags[0] & CLUSTERMSG_FLAG0_EXT_DATA) {
3171+
node->flags |= CLUSTER_NODE_EXTENSIONS_SUPPORTED;
3172+
}
3173+
setClusterNodeToInboundClusterLink(node, link);
31673174
clusterAddNode(node);
31683175
clusterDoBeforeSleep(CLUSTER_TODO_SAVE_CONFIG);
31693176
}

0 commit comments

Comments
 (0)