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
d4182a0a
Commit
d4182a0a
authored
Jun 27, 2018
by
artix
Browse files
Cluster Manager: more checks on --cluster-weight option.
parent
d222eda9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
d4182a0a
...
...
@@ -167,8 +167,8 @@ typedef struct clusterManagerCommand {
char
*
from
;
char
*
to
;
char
**
weight
;
char
*
master_id
;
int
weight_argc
;
char
*
master_id
;
int
slots
;
int
timeout
;
int
pipeline
;
...
...
@@ -1337,11 +1337,20 @@ static int parseOptions(int argc, char **argv) {
}
else
if
(
!
strcmp
(
argv
[
i
],
"--cluster-to"
)
&&
!
lastarg
)
{
config
.
cluster_manager_command
.
to
=
argv
[
++
i
];
}
else
if
(
!
strcmp
(
argv
[
i
],
"--cluster-weight"
)
&&
!
lastarg
)
{
if
(
config
.
cluster_manager_command
.
weight
!=
NULL
)
{
fprintf
(
stderr
,
"WARNING: you cannot use --cluster-weight "
"more than once.
\n
"
"You can set more weights by adding them "
"as a space-separated list, ie:
\n
"
"--cluster-weight n1=w n2=w
\n
"
);
exit
(
1
);
}
int
widx
=
i
+
1
;
char
**
weight
=
argv
+
widx
;
int
wargc
=
0
;
for
(;
widx
<
argc
;
widx
++
)
{
if
(
strstr
(
argv
[
widx
],
"--"
)
==
argv
[
widx
])
break
;
if
(
strchr
(
argv
[
widx
],
'='
)
==
NULL
)
break
;
wargc
++
;
}
if
(
wargc
>
0
)
{
...
...
@@ -4899,7 +4908,7 @@ static int clusterManagerCommandRebalance(int argc, char **argv) {
clusterManagerCheckCluster
(
1
);
if
(
cluster_manager
.
errors
&&
listLength
(
cluster_manager
.
errors
)
>
0
)
{
clusterManagerLogErr
(
"*** Please fix your cluster problems "
"before rebalancing"
);
"before rebalancing
\n
"
);
result
=
0
;
goto
cleanup
;
}
...
...
@@ -6610,6 +6619,7 @@ int main(int argc, char **argv) {
config
.
cluster_manager_command
.
from
=
NULL
;
config
.
cluster_manager_command
.
to
=
NULL
;
config
.
cluster_manager_command
.
weight
=
NULL
;
config
.
cluster_manager_command
.
weight_argc
=
0
;
config
.
cluster_manager_command
.
slots
=
0
;
config
.
cluster_manager_command
.
timeout
=
CLUSTER_MANAGER_MIGRATE_TIMEOUT
;
config
.
cluster_manager_command
.
pipeline
=
CLUSTER_MANAGER_MIGRATE_PIPELINE
;
...
...
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