summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-12-08 16:33:09 +0200
committerOran Agra <oran@redislabs.com>2021-01-12 16:25:37 +0200
commit5745b469d3f088e623b72b960e86d47c340fdc2f (patch)
treef7473deeb9c5a00ebbd88246b17ac0bd521d4d6f
parenta11c842ecdf44378834f7a54c7aa9529a7e6baa3 (diff)
downloadredis-5745b469d3f088e623b72b960e86d47c340fdc2f.tar.gz
Improve stability of new CSC eviction test (#8160)
c4fdf09c0 added a test that now fails with valgrind it fails for two resons: 1) the test samples the used memory and then limits the maxmemory to that value, but it turns out this is not atomic and on slow machines the background cron process that clean out old query buffers reduces the memory so that the setting doesn't cause eviction. 2) the dbsize was tested late, after reading some invalidation messages by that time more and more keys got evicted, partially draining the db. this is not the focus of this fix (still a known limitation) (cherry picked from commit a102b21d178453247078b355a47762bfc121ac20)
-rw-r--r--tests/unit/maxmemory.tcl16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/unit/maxmemory.tcl b/tests/unit/maxmemory.tcl
index 218f7bb1d..3e7f38194 100644
--- a/tests/unit/maxmemory.tcl
+++ b/tests/unit/maxmemory.tcl
@@ -270,6 +270,11 @@ start_server {tags {"maxmemory"}} {
}
}
+ # we need to wait one second for the client querybuf excess memory to be
+ # trimmed by cron, otherwise the INFO used_memory and CONFIG maxmemory
+ # below (on slow machines) won't be "atomic" and won't trigger eviction.
+ after 1100
+
# set the memory limit which will cause a few keys to be evicted
# we need to make sure to evict keynames of a total size of more than
# 16kb since the (PROTO_REPLY_CHUNK_BYTES), only after that the
@@ -281,13 +286,20 @@ start_server {tags {"maxmemory"}} {
# make sure some eviction happened
set evicted [s evicted_keys]
if {$::verbose} { puts "evicted: $evicted" }
+
+ # make sure we didn't drain the database
+ assert_range [r dbsize] 200 300
+
assert_range $evicted 10 50
foreach rd $clients {
$rd read ;# make sure we have some invalidation message waiting
$rd close
}
- # make sure we didn't drain the database
- assert_range [r dbsize] 200 300
+ # eviction continues (known problem described in #8069)
+ # for now this test only make sures the eviction loop itself doesn't
+ # have feedback loop
+ set evicted [s evicted_keys]
+ if {$::verbose} { puts "evicted: $evicted" }
}
}