summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrenJiang13 <yjjiang1996@163.com>2021-10-18 20:53:10 +0800
committerOran Agra <oran@redislabs.com>2022-04-27 16:31:52 +0300
commit8a0515d9a3bc80bda0f045790cc9f6211f6d656c (patch)
tree145ec4c2a8834b7072d8f8f04126e35bc229581d
parent21ab5d4f78891aec57818b8118367d339f0bfb5d (diff)
downloadredis-8a0515d9a3bc80bda0f045790cc9f6211f6d656c.tar.gz
add missed error counting (#9646)
* add: add missed error counting in sentinel.c and cluster.c (cherry picked from commit aa6deff01e3851d2f5d8bd4241a72cf6b76c063d)
-rw-r--r--src/cluster.c7
-rw-r--r--src/sentinel.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/src/cluster.c b/src/cluster.c
index b305353df..f11de5edf 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -5663,10 +5663,9 @@ socket_err:
/* Cleanup we want to do if no retry is attempted. */
zfree(ov); zfree(kv);
- addReplySds(c,
- sdscatprintf(sdsempty(),
- "-IOERR error or timeout %s to target instance\r\n",
- write_error ? "writing" : "reading"));
+ addReplyErrorSds(c, sdscatprintf(sdsempty(),
+ "-IOERR error or timeout %s to target instance",
+ write_error ? "writing" : "reading"));
return;
}
diff --git a/src/sentinel.c b/src/sentinel.c
index a9d123ebc..2c91eafd2 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -3684,11 +3684,11 @@ NULL
if ((ri = sentinelGetMasterByNameOrReplyError(c,c->argv[2])) == NULL)
return;
if (ri->flags & SRI_FAILOVER_IN_PROGRESS) {
- addReplySds(c,sdsnew("-INPROG Failover already in progress\r\n"));
+ addReplyError(c,"-INPROG Failover already in progress");
return;
}
if (sentinelSelectSlave(ri) == NULL) {
- addReplySds(c,sdsnew("-NOGOODSLAVE No suitable replica to promote\r\n"));
+ addReplyError(c,"-NOGOODSLAVE No suitable replica to promote");
return;
}
serverLog(LL_WARNING,"Executing user requested FAILOVER of '%s'",
@@ -3777,8 +3777,7 @@ NULL
e = sdscat(e, "Not enough available Sentinels to reach the"
" majority and authorize a failover");
}
- e = sdscat(e,"\r\n");
- addReplySds(c,e);
+ addReplyErrorSds(c,e);
}
} else if (!strcasecmp(c->argv[1]->ptr,"set")) {
if (c->argc < 3) goto numargserr;