Skip to content

Commit

Permalink
Update documentation, minor refactor, additional test case
Browse files Browse the repository at this point in the history
Signed-off-by: Karthik Subbarao <[email protected]>
  • Loading branch information
KarthikSubbarao committed May 20, 2024
1 parent bc0eaef commit 1c77f69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/script_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static void luaReplyToRedisReply(client *c, client* script_client, lua_State *lu
errorInfo err_info = {0};
luaExtractErrorInformation(lua, &err_info);
addReplyErrorFormatEx(c,
err_info.ignore_err_stats_update? ERR_REPLY_FLAG_NO_STATS_UPDATE | ERR_REPLY_FLAG_LUA: ERR_REPLY_FLAG_LUA,
ERR_REPLY_FLAG_LUA | (err_info.ignore_err_stats_update? ERR_REPLY_FLAG_NO_STATS_UPDATE: 0),
"-%s",
err_info.msg);
luaErrorInformationDiscard(&err_info);
Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -2564,7 +2564,7 @@ void serverSetCpuAffinity(const char *cpulist);

/* ERROR STATS constants */
#define ERROR_STATS_LUA_LIMIT 128 /* After the errors RAX reaches this limit, instead of tracking
custom LUA errors, we track the error under `error_LUA_ERRORSTATS_OVERFLOW`. */
custom LUA errors, we track the error under the symbol below. */
#define LUA_ERRORSTATS_OVERFLOW_ERR "LUA_ERRORSTATS_OVERFLOW"

/* afterErrorReply flags */
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/info.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ start_server {tags {"info" "external:skip"}} {
r config resetstat
for {set j 1} {$j <= 1100} {incr j} {
assert_error "$j my error message" {
r eval {return redis.error_reply(string.format('%s my error message', ARGV[1]))} 0 $j
r eval {return server.error_reply(string.format('%s my error message', ARGV[1]))} 0 $j
}
}
# Validate that custom LUA errors are tracked in `LUA_ERRORSTATS_OVERFLOW` when errors
Expand All @@ -287,6 +287,9 @@ start_server {tags {"info" "external:skip"}} {
# Validate that non LUA errors continue to be tracked even when we have >=128 entries.
assert_error {ERR syntax error} {r set a b c d e f g}
assert_equal "count=1" [errorstat ERR]
r eval {return server.error_reply(string.format('My error message'))} 0
r eval {return {err = 'My error message'}} 0
assert_equal "count=974" [errorstat LUA_ERRORSTATS_OVERFLOW]
}

test {stats: eventloop metrics} {
Expand Down

0 comments on commit 1c77f69

Please sign in to comment.