redis-cli --cluster-yes - negate force flag for clarity
this internal flag is there so that some commands do not comply to `--cluster-yes`
This commit is contained in:
parent
51077c8212
commit
1aa31e4da9
@ -1803,10 +1803,10 @@ static void usage(void) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int confirmWithYes(char *msg, int force) {
|
static int confirmWithYes(char *msg, int ignore_force) {
|
||||||
/* if force is true and --cluster-yes option is on,
|
/* if --cluster-yes option is set and ignore_force is false,
|
||||||
* do not prompt for an answer */
|
* do not prompt for an answer */
|
||||||
if (force &&
|
if (!ignore_force &&
|
||||||
(config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_YES)) {
|
(config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_YES)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -4500,7 +4500,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
dictReleaseIterator(iter);
|
dictReleaseIterator(iter);
|
||||||
|
|
||||||
/* we want explicit manual confirmation from users for all the fix cases */
|
/* we want explicit manual confirmation from users for all the fix cases */
|
||||||
int force = 0;
|
int ignore_force = 1;
|
||||||
|
|
||||||
/* Handle case "1": keys in no node. */
|
/* Handle case "1": keys in no node. */
|
||||||
if (listLength(none) > 0) {
|
if (listLength(none) > 0) {
|
||||||
@ -4508,7 +4508,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
"across the cluster:\n");
|
"across the cluster:\n");
|
||||||
clusterManagerPrintSlotsList(none);
|
clusterManagerPrintSlotsList(none);
|
||||||
if (confirmWithYes("Fix these slots by covering with a random node?",
|
if (confirmWithYes("Fix these slots by covering with a random node?",
|
||||||
force)) {
|
ignore_force)) {
|
||||||
listIter li;
|
listIter li;
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
listRewind(none, &li);
|
listRewind(none, &li);
|
||||||
@ -4535,7 +4535,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
printf("The following uncovered slots have keys in just one node:\n");
|
printf("The following uncovered slots have keys in just one node:\n");
|
||||||
clusterManagerPrintSlotsList(single);
|
clusterManagerPrintSlotsList(single);
|
||||||
if (confirmWithYes("Fix these slots by covering with those nodes?",
|
if (confirmWithYes("Fix these slots by covering with those nodes?",
|
||||||
force)) {
|
ignore_force)) {
|
||||||
listIter li;
|
listIter li;
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
listRewind(single, &li);
|
listRewind(single, &li);
|
||||||
@ -4567,7 +4567,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
|
|||||||
printf("The following uncovered slots have keys in multiple nodes:\n");
|
printf("The following uncovered slots have keys in multiple nodes:\n");
|
||||||
clusterManagerPrintSlotsList(multi);
|
clusterManagerPrintSlotsList(multi);
|
||||||
if (confirmWithYes("Fix these slots by moving keys "
|
if (confirmWithYes("Fix these slots by moving keys "
|
||||||
"into a single node?", force)) {
|
"into a single node?", ignore_force)) {
|
||||||
listIter li;
|
listIter li;
|
||||||
listNode *ln;
|
listNode *ln;
|
||||||
listRewind(multi, &li);
|
listRewind(multi, &li);
|
||||||
@ -5530,8 +5530,8 @@ assign_replicas:
|
|||||||
}
|
}
|
||||||
clusterManagerOptimizeAntiAffinity(ip_nodes, ip_count);
|
clusterManagerOptimizeAntiAffinity(ip_nodes, ip_count);
|
||||||
clusterManagerShowNodes();
|
clusterManagerShowNodes();
|
||||||
int force = 1;
|
int ignore_force = 0;
|
||||||
if (confirmWithYes("Can I set the above configuration?", force)) {
|
if (confirmWithYes("Can I set the above configuration?", ignore_force)) {
|
||||||
listRewind(cluster_manager.nodes, &li);
|
listRewind(cluster_manager.nodes, &li);
|
||||||
while ((ln = listNext(&li)) != NULL) {
|
while ((ln = listNext(&li)) != NULL) {
|
||||||
clusterManagerNode *node = ln->value;
|
clusterManagerNode *node = ln->value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user