Speed up test: client evicted due to client tracking prefixes (#11823)

We noticed that `client evicted due to client tracking prefixes`
takes over 200 seconds with valgrind.

We combine three prefixes in each command, this will probably
save us half the testing time.

Before: normal: 3508ms, valgrind: 289503ms -> 290s
With three prefixes, normal: 1500ms, valgrind: 135742ms -> 136s

Since we did not actually count the memory usage of all prefixes, see
getClientMemoryUsage, so we can not use larger prefixes to speed up the
test here. Also this PR cleaned up some spaces (IDE jobs) and typos.
This commit is contained in:
Binbin 2023-02-22 00:58:55 +08:00 committed by GitHub
parent dca5927ac8
commit cd58af4d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,7 +136,7 @@ start_server {} {
r flushdb
set rr [redis_client]
# Since watched key list is a small overheatd this test uses a minimal maxmemory-clients config
# Since watched key list is a small overhead this test uses a minimal maxmemory-clients config
set temp_maxmemory_clients 200000
r config set maxmemory-clients $temp_maxmemory_clients
@ -234,14 +234,17 @@ start_server {} {
r flushdb
set rr [redis_client]
# Since tracking prefixes list is a small overheatd this test uses a minimal maxmemory-clients config
# Since tracking prefixes list is a small overhead this test uses a minimal maxmemory-clients config
set temp_maxmemory_clients 200000
r config set maxmemory-clients $temp_maxmemory_clients
# Append tracking prefixes until list maxes out maxmemroy clients and causes client eviction
# Append tracking prefixes until list maxes out maxmemory clients and causes client eviction
# Combine more prefixes in each command to speed up the test. Because we did not actually count
# the memory usage of all prefixes, see getClientMemoryUsage, so we can not use larger prefixes
# to speed up the test here.
catch {
for {set j 0} {$j < $temp_maxmemory_clients} {incr j} {
$rr client tracking on prefix [format %012s $j] bcast
$rr client tracking on prefix [format a%09s $j] prefix [format b%09s $j] prefix [format c%09s $j] bcast
}
} e
assert_match {I/O error reading reply} $e