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
638db2fc
Unverified
Commit
638db2fc
authored
Dec 19, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Dec 19, 2018
Browse files
Merge pull request #5713 from artix75/cluster_manager_fix_cmd
Cluster Manager: enable --cluster-replace also for 'fix' command.
parents
f07205e4
503fd229
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
638db2fc
...
@@ -3149,48 +3149,47 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
...
@@ -3149,48 +3149,47 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
* - In other cases (ie. reshard), proceed only if the user
* - In other cases (ie. reshard), proceed only if the user
* launched the command with the --cluster-replace option.*/
* launched the command with the --cluster-replace option.*/
if
(
is_busy
)
{
if
(
is_busy
)
{
clusterManagerLogWarn
(
"
\n
*** Target key exists, "
clusterManagerLogWarn
(
"
\n
*** Target key exists
\n
"
);
"checking values...
\n
"
);
if
(
!
do_replace
)
{
list
*
diffs
=
listCreate
();
clusterManagerLogWarn
(
"*** Checking key values on "
success
=
clusterManagerCompareKeysValues
(
source
,
"both nodes...
\n
"
);
target
,
reply
,
diffs
);
list
*
diffs
=
listCreate
();
if
(
!
success
&&
(
do_fix
||
!
do_replace
))
{
success
=
clusterManagerCompareKeysValues
(
source
,
listRelease
(
diffs
);
target
,
reply
,
diffs
);
clusterManagerLogErr
(
"*** Value check failed!
\n
"
);
if
(
!
success
)
{
goto
next
;
clusterManagerLogErr
(
"*** Value check failed!
\n
"
);
}
listRelease
(
diffs
);
if
(
listLength
(
diffs
)
>
0
&&
(
do_fix
||
!
do_replace
))
{
goto
next
;
success
=
0
;
clusterManagerLogErr
(
"*** Found %d key(s) in both source node and "
"target node having different values.
\n
"
" Source node: %s:%d
\n
"
" Target node: %s:%d
\n
"
" Keys(s):
\n
"
,
listLength
(
diffs
),
source
->
ip
,
source
->
port
,
target
->
ip
,
target
->
port
);
listIter
dli
;
listNode
*
dln
;
listRewind
(
diffs
,
&
dli
);
while
((
dln
=
listNext
(
&
dli
))
!=
NULL
)
{
char
*
k
=
dln
->
value
;
clusterManagerLogErr
(
" - %s
\n
"
,
k
);
}
}
clusterManagerLogErr
(
"Please fix the above key(s) "
if
(
listLength
(
diffs
)
>
0
)
{
"manually "
);
success
=
0
;
if
(
do_fix
)
clusterManagerLogErr
(
clusterManagerLogErr
(
"and try again!
\n
"
);
"*** Found %d key(s) in both source node and "
else
{
"target node having different values.
\n
"
clusterManagerLogErr
(
"or relaunch the command "
" Source node: %s:%d
\n
"
" Target node: %s:%d
\n
"
" Keys(s):
\n
"
,
listLength
(
diffs
),
source
->
ip
,
source
->
port
,
target
->
ip
,
target
->
port
);
listIter
dli
;
listNode
*
dln
;
listRewind
(
diffs
,
&
dli
);
while
((
dln
=
listNext
(
&
dli
))
!=
NULL
)
{
char
*
k
=
dln
->
value
;
clusterManagerLogErr
(
" - %s
\n
"
,
k
);
}
clusterManagerLogErr
(
"Please fix the above key(s) "
"manually and try again "
"or relaunch the command
\n
"
"with --cluster-replace "
"with --cluster-replace "
"option to force key "
"option to force key "
"overriding.
\n
"
);
"overriding.
\n
"
);
listRelease
(
diffs
);
goto
next
;
}
}
listRelease
(
diffs
);
listRelease
(
diffs
);
goto
next
;
}
}
listRelease
(
diffs
);
clusterManagerLogWarn
(
"*** Replacing target keys...
\n
"
);
clusterManagerLogWarn
(
"*** Replacing target keys...
\n
"
);
}
}
freeReplyObject
(
migrate_reply
);
freeReplyObject
(
migrate_reply
);
...
...
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