Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
6183f059
Commit
6183f059
authored
Jul 18, 2018
by
antirez
Browse files
Refine comment in addReplyErrorLength() about replying to masters/slaves.
See #5135 for some context.
parent
8213f64d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
6183f059
...
@@ -342,6 +342,17 @@ void addReplyErrorLength(client *c, const char *s, size_t len) {
...
@@ -342,6 +342,17 @@ void addReplyErrorLength(client *c, const char *s, size_t len) {
if
(
!
len
||
s
[
0
]
!=
'-'
)
addReplyString
(
c
,
"-ERR "
,
5
);
if
(
!
len
||
s
[
0
]
!=
'-'
)
addReplyString
(
c
,
"-ERR "
,
5
);
addReplyString
(
c
,
s
,
len
);
addReplyString
(
c
,
s
,
len
);
addReplyString
(
c
,
"
\r\n
"
,
2
);
addReplyString
(
c
,
"
\r\n
"
,
2
);
/* Sometimes it could be normal that a slave replies to a master with
* an error and this function gets called. Actually the error will never
* be sent because addReply*() against master clients has no effect...
* A notable example is:
*
* EVAL 'redis.call("incr",KEYS[1]); redis.call("nonexisting")' 1 x
*
* Where the master must propagate the first change even if the second
* will produce an error. However it is useful to log such events since
* they are rare and may hint at errors in a script or a bug in Redis. */
if
(
c
->
flags
&
(
CLIENT_MASTER
|
CLIENT_SLAVE
))
{
if
(
c
->
flags
&
(
CLIENT_MASTER
|
CLIENT_SLAVE
))
{
char
*
to
=
c
->
flags
&
CLIENT_MASTER
?
"master"
:
"slave"
;
char
*
to
=
c
->
flags
&
CLIENT_MASTER
?
"master"
:
"slave"
;
char
*
from
=
c
->
flags
&
CLIENT_MASTER
?
"slave"
:
"master"
;
char
*
from
=
c
->
flags
&
CLIENT_MASTER
?
"slave"
:
"master"
;
...
...
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