MCPcopy Create free account
hub / github.com/F-Stack/f-stack / clusterRenameNode

Function clusterRenameNode

app/redis-6.2.6/src/cluster.c:1039–1050  ·  view source on GitHub ↗

This is only used after the handshake. When we connect a given IP/PORT * as a result of CLUSTER MEET we don't have the node name yet, so we * pick a random one, and will fix it when we receive the PONG request using * this function. */

Source from the content-addressed store, hash-verified

1037 * pick a random one, and will fix it when we receive the PONG request using
1038 * this function. */
1039void clusterRenameNode(clusterNode *node, char *newname) {
1040 int retval;
1041 sds s = sdsnewlen(node->name, CLUSTER_NAMELEN);
1042
1043 serverLog(LL_DEBUG,"Renaming node %.40s into %.40s",
1044 node->name, newname);
1045 retval = dictDelete(server.cluster->nodes, s);
1046 sdsfree(s);
1047 serverAssert(retval == DICT_OK);
1048 memcpy(node->name, newname, CLUSTER_NAMELEN);
1049 clusterAddNode(node);
1050}
1051
1052/* -----------------------------------------------------------------------------
1053 * CLUSTER config epoch handling

Callers 1

clusterProcessPacketFunction · 0.85

Calls 5

sdsnewlenFunction · 0.85
sdsfreeFunction · 0.85
clusterAddNodeFunction · 0.85
dictDeleteFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected