summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-07-18 17:40:07 +0200
committerantirez <antirez@gmail.com>2018-07-18 17:40:07 +0200
commit6183f0590dede55ceeb9019899343170d38197d0 (patch)
treee6ee0ee215bb26d250f4be05955f526cb20bb1c2
parent8213f64d6433509ba9cd98a993f5b4c715fef10d (diff)
downloadredis-6183f0590dede55ceeb9019899343170d38197d0.tar.gz
Refine comment in addReplyErrorLength() about replying to masters/slaves.
See #5135 for some context.
-rw-r--r--src/networking.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/networking.c b/src/networking.c
index 22850a4b6..c08d71998 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -342,6 +342,17 @@ void addReplyErrorLength(client *c, const char *s, size_t len) {
if (!len || s[0] != '-') addReplyString(c,"-ERR ",5);
addReplyString(c,s,len);
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)) {
char* to = c->flags & CLIENT_MASTER? "master": "slave";
char* from = c->flags & CLIENT_MASTER? "slave": "master";