| 5424 | } |
| 5425 | |
| 5426 | static clusterManagerNode *clusterNodeForResharding(char *id, |
| 5427 | clusterManagerNode *target, |
| 5428 | int *raise_err) |
| 5429 | { |
| 5430 | clusterManagerNode *node = NULL; |
| 5431 | const char *invalid_node_msg = "*** The specified node (%s) is not known " |
| 5432 | "or not a master, please retry.\n"; |
| 5433 | node = clusterManagerNodeByName(id); |
| 5434 | *raise_err = 0; |
| 5435 | if (!node || node->flags & CLUSTER_MANAGER_FLAG_SLAVE) { |
| 5436 | clusterManagerLogErr(invalid_node_msg, id); |
| 5437 | *raise_err = 1; |
| 5438 | return NULL; |
| 5439 | } else if (target != NULL) { |
| 5440 | if (!strcmp(node->name, target->name)) { |
| 5441 | clusterManagerLogErr( "*** It is not possible to use " |
| 5442 | "the target node as " |
| 5443 | "source node.\n"); |
| 5444 | return NULL; |
| 5445 | } |
| 5446 | } |
| 5447 | return node; |
| 5448 | } |
| 5449 | |
| 5450 | static list *clusterManagerComputeReshardTable(list *sources, int numslots) { |
| 5451 | list *moved = listCreate(); |
no test coverage detected