Cluster Manager: enable --cluster-replace also for 'fix' command.

This commit is contained in:
artix 2018-12-19 17:27:58 +01:00
parent f07205e48c
commit 503fd229e4

View File

@ -3149,17 +3149,19 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
* - In other cases (ie. reshard), proceed only if the user
* launched the command with the --cluster-replace option.*/
if (is_busy) {
clusterManagerLogWarn("\n*** Target key exists, "
"checking values...\n");
clusterManagerLogWarn("\n*** Target key exists\n");
if (!do_replace) {
clusterManagerLogWarn("*** Checking key values on "
"both nodes...\n");
list *diffs = listCreate();
success = clusterManagerCompareKeysValues(source,
target, reply, diffs);
if (!success && (do_fix || !do_replace)) {
listRelease(diffs);
if (!success) {
clusterManagerLogErr("*** Value check failed!\n");
listRelease(diffs);
goto next;
}
if (listLength(diffs) > 0 && (do_fix || !do_replace)) {
if (listLength(diffs) > 0) {
success = 0;
clusterManagerLogErr(
"*** Found %d key(s) in both source node and "
@ -3178,19 +3180,16 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
clusterManagerLogErr(" - %s\n", k);
}
clusterManagerLogErr("Please fix the above key(s) "
"manually ");
if (do_fix)
clusterManagerLogErr("and try again!\n");
else {
clusterManagerLogErr("or relaunch the command "
"manually and try again "
"or relaunch the command \n"
"with --cluster-replace "
"option to force key "
"overriding.\n");
}
listRelease(diffs);
goto next;
}
listRelease(diffs);
}
clusterManagerLogWarn("*** Replacing target keys...\n");
}
freeReplyObject(migrate_reply);