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
43eb0ce3
Unverified
Commit
43eb0ce3
authored
Aug 07, 2021
by
DarrenJiang13
Committed by
GitHub
Aug 06, 2021
Browse files
[BUGFIX] Add some missed error statistics (#9328)
add error counting for some missed behaviors.
parent
0a937753
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
43eb0ce3
...
@@ -165,7 +165,7 @@ robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags) {
...
@@ -165,7 +165,7 @@ robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags) {
robj
*
lookupKeyWrite
(
redisDb
*
db
,
robj
*
key
)
{
robj
*
lookupKeyWrite
(
redisDb
*
db
,
robj
*
key
)
{
return
lookupKeyWriteWithFlags
(
db
,
key
,
LOOKUP_NONE
);
return
lookupKeyWriteWithFlags
(
db
,
key
,
LOOKUP_NONE
);
}
}
static
void
SentReplyOnKeyMiss
(
client
*
c
,
robj
*
reply
){
void
SentReplyOnKeyMiss
(
client
*
c
,
robj
*
reply
){
serverAssert
(
sdsEncodedObject
(
reply
));
serverAssert
(
sdsEncodedObject
(
reply
));
sds
rep
=
reply
->
ptr
;
sds
rep
=
reply
->
ptr
;
if
(
sdslen
(
rep
)
>
1
&&
rep
[
0
]
==
'-'
){
if
(
sdslen
(
rep
)
>
1
&&
rep
[
0
]
==
'-'
){
...
...
src/multi.c
View file @
43eb0ce3
...
@@ -179,9 +179,13 @@ void execCommand(client *c) {
...
@@ -179,9 +179,13 @@ void execCommand(client *c) {
* A failed EXEC in the first case returns a multi bulk nil object
* A failed EXEC in the first case returns a multi bulk nil object
* (technically it is not an error but a special behavior), while
* (technically it is not an error but a special behavior), while
* in the second an EXECABORT error is returned. */
* in the second an EXECABORT error is returned. */
if
(
c
->
flags
&
(
CLIENT_DIRTY_CAS
|
CLIENT_DIRTY_EXEC
))
{
if
(
c
->
flags
&
(
CLIENT_DIRTY_CAS
|
CLIENT_DIRTY_EXEC
))
{
addReply
(
c
,
c
->
flags
&
CLIENT_DIRTY_EXEC
?
shared
.
execaborterr
:
if
(
c
->
flags
&
CLIENT_DIRTY_EXEC
)
{
shared
.
nullarray
[
c
->
resp
]);
addReplyErrorObject
(
c
,
shared
.
execaborterr
);
}
else
{
addReply
(
c
,
shared
.
nullarray
[
c
->
resp
]);
}
discardTransaction
(
c
);
discardTransaction
(
c
);
return
;
return
;
}
}
...
...
src/object.c
View file @
43eb0ce3
...
@@ -1402,8 +1402,7 @@ robj *objectCommandLookup(client *c, robj *key) {
...
@@ -1402,8 +1402,7 @@ robj *objectCommandLookup(client *c, robj *key) {
robj
*
objectCommandLookupOrReply
(
client
*
c
,
robj
*
key
,
robj
*
reply
)
{
robj
*
objectCommandLookupOrReply
(
client
*
c
,
robj
*
key
,
robj
*
reply
)
{
robj
*
o
=
objectCommandLookup
(
c
,
key
);
robj
*
o
=
objectCommandLookup
(
c
,
key
);
if
(
!
o
)
SentReplyOnKeyMiss
(
c
,
reply
);
if
(
!
o
)
addReply
(
c
,
reply
);
return
o
;
return
o
;
}
}
...
...
src/server.h
View file @
43eb0ce3
...
@@ -2394,6 +2394,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags);
...
@@ -2394,6 +2394,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags);
robj
*
lookupKeyWriteWithFlags
(
redisDb
*
db
,
robj
*
key
,
int
flags
);
robj
*
lookupKeyWriteWithFlags
(
redisDb
*
db
,
robj
*
key
,
int
flags
);
robj
*
objectCommandLookup
(
client
*
c
,
robj
*
key
);
robj
*
objectCommandLookup
(
client
*
c
,
robj
*
key
);
robj
*
objectCommandLookupOrReply
(
client
*
c
,
robj
*
key
,
robj
*
reply
);
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
,
int
objectSetLRUOrLFU
(
robj
*
val
,
long
long
lfu_freq
,
long
long
lru_idle
,
long
long
lru_clock
,
int
lru_multiplier
);
long
long
lru_clock
,
int
lru_multiplier
);
#define LOOKUP_NONE 0
#define LOOKUP_NONE 0
...
...
tests/unit/info.tcl
View file @
43eb0ce3
...
@@ -110,11 +110,12 @@ start_server {tags {"info" "external:skip"}} {
...
@@ -110,11 +110,12 @@ start_server {tags {"info" "external:skip"}} {
catch
{
r exec
}
e
catch
{
r exec
}
e
assert_match
{
EXECABORT*
}
$e
assert_match
{
EXECABORT*
}
$e
assert_match
{
*count=1*
}
[
errorstat ERR
]
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=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 multi
]
assert_match
{
*calls=1,*,rejected_calls=0,failed_calls=
0
}
[
cmdstat exec
]
assert_match
{
*calls=1,*,rejected_calls=0,failed_calls=
1
}
[
cmdstat exec
]
assert_equal
[
s total_error_replies
]
1
assert_equal
[
s total_error_replies
]
2
r config resetstat
r config resetstat
assert_match
{}
[
errorstat ERR
]
assert_match
{}
[
errorstat ERR
]
}
}
...
...
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