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
1e4fb1b3
Commit
1e4fb1b3
authored
May 16, 2018
by
artix
Browse files
Cluster Manager: fixed unprinted reply error
parent
2f9c032a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
1e4fb1b3
...
@@ -2773,7 +2773,8 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
...
@@ -2773,7 +2773,8 @@ static int clusterManagerMigrateKeysInSlot(clusterManagerNode *source,
strcpy
(
*
err
,
migrate_reply
->
str
);
strcpy
(
*
err
,
migrate_reply
->
str
);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
CLUSTER_MANAGER_PRINT_REPLY_ERROR
(
source
,
err
);
CLUSTER_MANAGER_PRINT_REPLY_ERROR
(
source
,
migrate_reply
->
str
);
}
}
goto
next
;
goto
next
;
}
}
...
@@ -3021,7 +3022,6 @@ static int clusterManagerNodeLoadInfo(clusterManagerNode *node, int opts,
...
@@ -3021,7 +3022,6 @@ static int clusterManagerNodeLoadInfo(clusterManagerNode *node, int opts,
else
break
;
else
break
;
}
else
{
}
else
{
if
(
addr
==
NULL
)
{
if
(
addr
==
NULL
)
{
// TODO: find a better err message
fprintf
(
stderr
,
"Error: invalid CLUSTER NODES reply
\n
"
);
fprintf
(
stderr
,
"Error: invalid CLUSTER NODES reply
\n
"
);
success
=
0
;
success
=
0
;
goto
cleanup
;
goto
cleanup
;
...
@@ -4602,7 +4602,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
...
@@ -4602,7 +4602,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
fflush
(
stdout
);
fflush
(
stdout
);
char
buf
[
6
];
char
buf
[
6
];
int
nread
=
read
(
fileno
(
stdin
),
buf
,
6
);
int
nread
=
read
(
fileno
(
stdin
),
buf
,
6
);
if
(
!
nread
)
continue
;
//TODO: nread < 0
if
(
nread
<=
0
)
continue
;
int
last_idx
=
nread
-
1
;
int
last_idx
=
nread
-
1
;
if
(
buf
[
last_idx
]
!=
'\n'
)
{
if
(
buf
[
last_idx
]
!=
'\n'
)
{
int
ch
;
int
ch
;
...
@@ -4619,7 +4619,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
...
@@ -4619,7 +4619,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
printf
(
"What is the receiving node ID? "
);
printf
(
"What is the receiving node ID? "
);
fflush
(
stdout
);
fflush
(
stdout
);
int
nread
=
read
(
fileno
(
stdin
),
buf
,
255
);
int
nread
=
read
(
fileno
(
stdin
),
buf
,
255
);
if
(
!
nread
)
continue
;
//TODO: nread < 0
if
(
nread
<=
0
)
continue
;
int
last_idx
=
nread
-
1
;
int
last_idx
=
nread
-
1
;
if
(
buf
[
last_idx
]
!=
'\n'
)
{
if
(
buf
[
last_idx
]
!=
'\n'
)
{
int
ch
;
int
ch
;
...
@@ -4643,7 +4643,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
...
@@ -4643,7 +4643,7 @@ static int clusterManagerCommandReshard(int argc, char **argv) {
printf
(
"Source node #%lu: "
,
listLength
(
sources
)
+
1
);
printf
(
"Source node #%lu: "
,
listLength
(
sources
)
+
1
);
fflush
(
stdout
);
fflush
(
stdout
);
int
nread
=
read
(
fileno
(
stdin
),
buf
,
255
);
int
nread
=
read
(
fileno
(
stdin
),
buf
,
255
);
if
(
!
nread
)
continue
;
//TODO: nread < 0
if
(
nread
<=
0
)
continue
;
int
last_idx
=
nread
-
1
;
int
last_idx
=
nread
-
1
;
if
(
buf
[
last_idx
]
!=
'\n'
)
{
if
(
buf
[
last_idx
]
!=
'\n'
)
{
int
ch
;
int
ch
;
...
@@ -5176,7 +5176,7 @@ static int clusterManagerCommandCall(int argc, char **argv) {
...
@@ -5176,7 +5176,7 @@ static int clusterManagerCommandCall(int argc, char **argv) {
redisAppendCommandArgv
(
n
->
context
,
argc
,
(
const
char
**
)
argv
,
argvlen
);
redisAppendCommandArgv
(
n
->
context
,
argc
,
(
const
char
**
)
argv
,
argvlen
);
int
status
=
redisGetReply
(
n
->
context
,
(
void
**
)(
&
reply
));
int
status
=
redisGetReply
(
n
->
context
,
(
void
**
)(
&
reply
));
if
(
status
!=
REDIS_OK
||
reply
==
NULL
)
if
(
status
!=
REDIS_OK
||
reply
==
NULL
)
printf
(
"%s:%d: Failed!
\n
"
,
n
->
ip
,
n
->
port
);
//TODO: better message?
printf
(
"%s:%d: Failed!
\n
"
,
n
->
ip
,
n
->
port
);
else
{
else
{
sds
formatted_reply
=
cliFormatReplyTTY
(
reply
,
""
);
sds
formatted_reply
=
cliFormatReplyTTY
(
reply
,
""
);
printf
(
"%s:%d: %s
\n
"
,
n
->
ip
,
n
->
port
,
(
char
*
)
formatted_reply
);
printf
(
"%s:%d: %s
\n
"
,
n
->
ip
,
n
->
port
,
(
char
*
)
formatted_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