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

Function clusterNodeForResharding

src/redis-cli.c:4513–4535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4511}
4512
4513static clusterManagerNode *clusterNodeForResharding(char *id,
4514 clusterManagerNode *target,
4515 int *raise_err)
4516{
4517 clusterManagerNode *node = NULL;
4518 const char *invalid_node_msg = "*** The specified node (%s) is not known "
4519 "or not a master, please retry.\n";
4520 node = clusterManagerNodeByName(id);
4521 *raise_err = 0;
4522 if (!node || node->flags & CLUSTER_MANAGER_FLAG_SLAVE) {
4523 clusterManagerLogErr(invalid_node_msg, id);
4524 *raise_err = 1;
4525 return NULL;
4526 } else if (target != NULL) {
4527 if (!strcmp(node->name, target->name)) {
4528 clusterManagerLogErr( "*** It is not possible to use "
4529 "the target node as "
4530 "source node.\n");
4531 return NULL;
4532 }
4533 }
4534 return node;
4535}
4536
4537static list *clusterManagerComputeReshardTable(list *sources, int numslots) {
4538 list *moved = listCreate();

Callers 1

Calls 1

clusterManagerNodeByNameFunction · 0.85

Tested by

no test coverage detected