ClusterManager: fixed --cluster-from 'all' parsing

This commit is contained in:
artix 2018-03-02 17:06:50 +01:00
parent ce14d23740
commit d518733073

View File

@ -3137,12 +3137,12 @@ static clusterManagerNode *clusterNodeForResharding(char *id,
int *raise_err) int *raise_err)
{ {
clusterManagerNode *node = NULL; clusterManagerNode *node = NULL;
const char *invalid_node_msg = "*** The specified node is not known or " const char *invalid_node_msg = "*** The specified node (%s) is not known "
"not a master, please retry.\n"; "or not a master, please retry.\n";
node = clusterManagerNodeByName(id); node = clusterManagerNodeByName(id);
*raise_err = 0; *raise_err = 0;
if (!node || node->flags & CLUSTER_MANAGER_FLAG_SLAVE) { if (!node || node->flags & CLUSTER_MANAGER_FLAG_SLAVE) {
clusterManagerLogErr(invalid_node_msg); clusterManagerLogErr(invalid_node_msg, id);
*raise_err = 1; *raise_err = 1;
return NULL; return NULL;
} else if (node != NULL && target != NULL) { } else if (node != NULL && target != NULL) {
@ -3700,12 +3700,15 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
} }
/* Check if there's still another source to process. */ /* Check if there's still another source to process. */
if (!all && strlen(from) > 0) { if (!all && strlen(from) > 0) {
clusterManagerNode *src = if (!strcmp(from, "all")) all = 1;
clusterNodeForResharding(from, target, &raise_err); if (!all) {
if (src != NULL) listAddNodeTail(sources, src); clusterManagerNode *src =
else if (raise_err) { clusterNodeForResharding(from, target, &raise_err);
result = 0; if (src != NULL) listAddNodeTail(sources, src);
goto cleanup; else if (raise_err) {
result = 0;
goto cleanup;
}
} }
} }
} }