MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / clusterRenameNode

Function clusterRenameNode

src/cluster.cpp:1078–1089  ·  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

1076 * pick a random one, and will fix it when we receive the PONG request using
1077 * this function. */
1078void clusterRenameNode(clusterNode *node, char *newname) {
1079 int retval;
1080 sds s = sdsnewlen(node->name, CLUSTER_NAMELEN);
1081
1082 serverLog(LL_DEBUG,"Renaming node %.40s into %.40s",
1083 node->name, newname);
1084 retval = dictDelete(g_pserver->cluster->nodes, s);
1085 sdsfree(s);
1086 serverAssert(retval == DICT_OK);
1087 memcpy(node->name, newname, CLUSTER_NAMELEN);
1088 clusterAddNode(node);
1089}
1090
1091/* -----------------------------------------------------------------------------
1092 * CLUSTER config epoch handling

Callers 1

clusterProcessPacketFunction · 0.85

Calls 5

sdsnewlenFunction · 0.85
serverLogFunction · 0.85
sdsfreeFunction · 0.85
clusterAddNodeFunction · 0.85
dictDeleteFunction · 0.70

Tested by

no test coverage detected