[BUGFIX] Add some missed error statistics (#9328)
add error counting for some missed behaviors. (cherry picked from commit 43eb0ce3bf76a5d287b93a767bead9ad6230a1ad)
This commit is contained in:
parent
4b04ca0b18
commit
1ed0f049fe
2
src/db.c
2
src/db.c
@ -165,7 +165,7 @@ robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags) {
|
||||
robj *lookupKeyWrite(redisDb *db, robj *key) {
|
||||
return lookupKeyWriteWithFlags(db, key, LOOKUP_NONE);
|
||||
}
|
||||
static void SentReplyOnKeyMiss(client *c, robj *reply){
|
||||
void SentReplyOnKeyMiss(client *c, robj *reply){
|
||||
serverAssert(sdsEncodedObject(reply));
|
||||
sds rep = reply->ptr;
|
||||
if (sdslen(rep) > 1 && rep[0] == '-'){
|
||||
|
10
src/multi.c
10
src/multi.c
@ -179,9 +179,13 @@ void execCommand(client *c) {
|
||||
* A failed EXEC in the first case returns a multi bulk nil object
|
||||
* (technically it is not an error but a special behavior), while
|
||||
* in the second an EXECABORT error is returned. */
|
||||
if (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC)) {
|
||||
addReply(c, c->flags & CLIENT_DIRTY_EXEC ? shared.execaborterr :
|
||||
shared.nullarray[c->resp]);
|
||||
if (c->flags & (CLIENT_DIRTY_CAS | CLIENT_DIRTY_EXEC)) {
|
||||
if (c->flags & CLIENT_DIRTY_EXEC) {
|
||||
addReplyErrorObject(c, shared.execaborterr);
|
||||
} else {
|
||||
addReply(c, shared.nullarray[c->resp]);
|
||||
}
|
||||
|
||||
discardTransaction(c);
|
||||
return;
|
||||
}
|
||||
|
@ -1246,8 +1246,7 @@ robj *objectCommandLookup(client *c, robj *key) {
|
||||
|
||||
robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply) {
|
||||
robj *o = objectCommandLookup(c,key);
|
||||
|
||||
if (!o) addReply(c, reply);
|
||||
if (!o) SentReplyOnKeyMiss(c, reply);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -2339,6 +2339,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags);
|
||||
robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags);
|
||||
robj *objectCommandLookup(client *c, robj *key);
|
||||
robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply);
|
||||
void SentReplyOnKeyMiss(client *c, robj *reply);
|
||||
int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle,
|
||||
long long lru_clock, int lru_multiplier);
|
||||
#define LOOKUP_NONE 0
|
||||
|
@ -110,11 +110,12 @@ start_server {tags {"info"}} {
|
||||
catch {r exec} e
|
||||
assert_match {EXECABORT*} $e
|
||||
assert_match {*count=1*} [errorstat ERR]
|
||||
assert_equal [s total_error_replies] 1
|
||||
assert_match {*count=1*} [errorstat EXECABORT]
|
||||
assert_equal [s total_error_replies] 2
|
||||
assert_match {*calls=0,*,rejected_calls=1,failed_calls=0} [cmdstat set]
|
||||
assert_match {*calls=1,*,rejected_calls=0,failed_calls=0} [cmdstat multi]
|
||||
assert_match {*calls=1,*,rejected_calls=0,failed_calls=0} [cmdstat exec]
|
||||
assert_equal [s total_error_replies] 1
|
||||
assert_match {*calls=1,*,rejected_calls=0,failed_calls=1} [cmdstat exec]
|
||||
assert_equal [s total_error_replies] 2
|
||||
r config resetstat
|
||||
assert_match {} [errorstat ERR]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user