diff --git a/tests/integration/aof.tcl b/tests/integration/aof.tcl index d4a556e3b..0a9f250cf 100644 --- a/tests/integration/aof.tcl +++ b/tests/integration/aof.tcl @@ -239,7 +239,7 @@ tags {"aof external:skip"} { } } - start_server {overrides {appendonly {yes}}} { + start_server {overrides {appendonly {yes} appendfsync always}} { test {GETEX should not append to AOF} { set aof [get_last_incr_aof_path r] r set foo bar diff --git a/tests/unit/maxmemory.tcl b/tests/unit/maxmemory.tcl index f8de1a410..23a9daab8 100644 --- a/tests/unit/maxmemory.tcl +++ b/tests/unit/maxmemory.tcl @@ -421,13 +421,19 @@ start_server {tags {"maxmemory external:skip"}} { } {4098} } -start_server {tags {"maxmemory external:skip tsan:skip"}} { +start_server {tags {"maxmemory external:skip"}} { test {client tracking don't cause eviction feedback loop} { r config set latency-tracking no r config set maxmemory 0 r config set maxmemory-policy allkeys-lru r config set maxmemory-eviction-tenacity 100 + # check if enabling multithreaded IO + set multithreaded 0 + if {[r config get io-threads] > 1} { + set multithreaded 1 + } + # 10 clients listening on tracking messages set clients {} for {set j 0} {$j < 10} {incr j} { @@ -465,6 +471,15 @@ start_server {tags {"maxmemory external:skip tsan:skip"}} { set limit [expr {$used - 40000}] r config set maxmemory $limit + # If multithreaded, we need to let IO threads have chance to reply output + # buffer, to avoid next commands causing eviction. After eviction is performed, + # the next command becomes ready immediately in IO threads, and now we enqueue + # the client to be processed in main thread’s beforeSleep without notification. + # However, invalidation messages generated by eviction may not have been fully + # delivered by that time. As a result, executing the command in beforeSleep of + # the event loop (running eviction) can cause additional keys to be evicted. + if $multithreaded { after 200 } + # make sure some eviction happened set evicted [s evicted_keys] if {$::verbose} { puts "evicted: $evicted" }