Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c9ef9f1c
Unverified
Commit
c9ef9f1c
authored
May 18, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
May 18, 2020
Browse files
Merge pull request #7247 from bsergean/patch-3
Redis-cli 6.0.1 `--cluster-yes` doesn't work (fix #7246)
parents
05db78e9
f4d2abd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
c9ef9f1c
...
@@ -1797,7 +1797,14 @@ static void usage(void) {
...
@@ -1797,7 +1797,14 @@ static void usage(void) {
exit
(
1
);
exit
(
1
);
}
}
static
int
confirmWithYes
(
char
*
msg
)
{
static
int
confirmWithYes
(
char
*
msg
,
int
force
)
{
/* if force is true and --cluster-yes option is on,
* do not prompt for an answer */
if
(
force
&&
(
config
.
cluster_manager_command
.
flags
&
CLUSTER_MANAGER_CMD_FLAG_YES
))
{
return
1
;
}
printf
(
"%s (type 'yes' to accept): "
,
msg
);
printf
(
"%s (type 'yes' to accept): "
,
msg
);
fflush
(
stdout
);
fflush
(
stdout
);
char
buf
[
4
];
char
buf
[
4
];
...
@@ -4485,12 +4492,16 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -4485,12 +4492,16 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
}
}
dictReleaseIterator
(
iter
);
dictReleaseIterator
(
iter
);
/* we want explicit manual confirmation from users for all the fix cases */
int
force
=
0
;
/* Handle case "1": keys in no node. */
/* Handle case "1": keys in no node. */
if
(
listLength
(
none
)
>
0
)
{
if
(
listLength
(
none
)
>
0
)
{
printf
(
"The following uncovered slots have no keys "
printf
(
"The following uncovered slots have no keys "
"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
))
{
listIter
li
;
listIter
li
;
listNode
*
ln
;
listNode
*
ln
;
listRewind
(
none
,
&
li
);
listRewind
(
none
,
&
li
);
...
@@ -4516,7 +4527,8 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -4516,7 +4527,8 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
if
(
listLength
(
single
)
>
0
)
{
if
(
listLength
(
single
)
>
0
)
{
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
))
{
listIter
li
;
listIter
li
;
listNode
*
ln
;
listNode
*
ln
;
listRewind
(
single
,
&
li
);
listRewind
(
single
,
&
li
);
...
@@ -4548,7 +4560,7 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
...
@@ -4548,7 +4560,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?"
))
{
"into a single node?"
,
force
))
{
listIter
li
;
listIter
li
;
listNode
*
ln
;
listNode
*
ln
;
listRewind
(
multi
,
&
li
);
listRewind
(
multi
,
&
li
);
...
@@ -5511,7 +5523,8 @@ assign_replicas:
...
@@ -5511,7 +5523,8 @@ assign_replicas:
}
}
clusterManagerOptimizeAntiAffinity
(
ip_nodes
,
ip_count
);
clusterManagerOptimizeAntiAffinity
(
ip_nodes
,
ip_count
);
clusterManagerShowNodes
();
clusterManagerShowNodes
();
if
(
confirmWithYes
(
"Can I set the above configuration?"
))
{
int
force
=
1
;
if
(
confirmWithYes
(
"Can I set the above configuration?"
,
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment