Skip to content

Commit

Permalink
Rename LUA Error Stat overflow error message
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 c86cb62 commit bc0eaef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/networking.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) {
/* After the errors RAX reaches this limit, instead of tracking
* custom LUA errors, we track the error under `error_LUA` */
if (flags & ERR_REPLY_FLAG_LUA && raxSize(server.errors) >= ERROR_STATS_LUA_LIMIT) {
incrementErrorCount("LUA_ERRORSTATS_DISABLED", 23);
incrementErrorCount(LUA_ERRORSTATS_OVERFLOW_ERR, strlen(LUA_ERRORSTATS_OVERFLOW_ERR));
/* If the string already starts with "-..." then the error prefix
* is provided by the caller ( we limit the search to 32 chars). Otherwise we use "-ERR". */
} else if (s[0] != '-') {
Expand Down
3 changes: 2 additions & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -2564,7 +2564,8 @@ 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`. */
custom LUA errors, we track the error under `error_LUA_ERRORSTATS_OVERFLOW`. */
#define LUA_ERRORSTATS_OVERFLOW_ERR "LUA_ERRORSTATS_OVERFLOW"

/* afterErrorReply flags */
#define ERR_REPLY_FLAG_NO_STATS_UPDATE (1ULL<<0) /* Indicating that we should not update
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/info.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ start_server {tags {"info" "external:skip"}} {
r eval {return redis.error_reply(string.format('%s my error message', ARGV[1]))} 0 $j
}
}
# Validate that custom LUA errors are tracked in `LUA_ERRORSTATS_DISABLED` when errors
# Validate that custom LUA errors are tracked in `LUA_ERRORSTATS_OVERFLOW` when errors
# has 128 entries.
assert_equal "count=972" [errorstat LUA_ERRORSTATS_DISABLED]
assert_equal "count=972" [errorstat LUA_ERRORSTATS_OVERFLOW]
# 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]
Expand Down

0 comments on commit bc0eaef

Please sign in to comment.