mirror of
https://github.com/fluencelabs/redis
synced 2025-07-02 18:31:34 +00:00
Limit memory used by big SLOWLOG entries.
Two limits are added: 1) Up to SLOWLOG_ENTRY_MAX_ARGV arguments are logged. 2) Up to SLOWLOG_ENTRY_MAX_STRING bytes per argument are logged. 3) slowlog-max-len is set to 128 by default (was 1024). The number of remaining arguments / bytes is logged in the entry so that the user can understand better the nature of the logged command.
This commit is contained in:
@ -38,4 +38,21 @@ start_server {tags {"slowlog"} overrides {slowlog-log-slower-than 1000000}} {
|
||||
assert_equal [expr {[lindex $e 2] > 100000}] 1
|
||||
assert_equal [lindex $e 3] {debug sleep 0.2}
|
||||
}
|
||||
|
||||
test {SLOWLOG - commands with too many arguments are trimmed} {
|
||||
r config set slowlog-log-slower-than 0
|
||||
r slowlog reset
|
||||
r sadd set 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
||||
set e [lindex [r slowlog get] 0]
|
||||
lindex $e 3
|
||||
} {sadd set 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 {... (2 more arguments)}}
|
||||
|
||||
test {SLOWLOG - too long arguments are trimmed} {
|
||||
r config set slowlog-log-slower-than 0
|
||||
r slowlog reset
|
||||
set arg [string repeat A 129]
|
||||
r sadd set foo $arg
|
||||
set e [lindex [r slowlog get] 0]
|
||||
lindex $e 3
|
||||
} {sadd set foo {AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... (1 more bytes)}}
|
||||
}
|
||||
|
Reference in New Issue
Block a user