Unverified Commit 0f15e025 authored by guybe7's avatar guybe7 Committed by GitHub
Browse files

Fix race in propagation test (#10012)

There's a race between testing DBSIZE and the thread starting.
If the thread hadn't started by the time we checked DBISZE, no
keys will have been evicted.
The correct way is to check the evicted_keys stat.
parent e84ccc3f
...@@ -157,11 +157,12 @@ tags "modules" { ...@@ -157,11 +157,12 @@ tags "modules" {
# Please note we use volatile eviction to prevent the loop described in the test above. # Please note we use volatile eviction to prevent the loop described in the test above.
# "notifications" is not volatile so it always remains # "notifications" is not volatile so it always remains
$master config resetstat
$master config set maxmemory-policy volatile-ttl $master config set maxmemory-policy volatile-ttl
$master config set maxmemory 1 $master config set maxmemory 1
wait_for_condition 500 10 { wait_for_condition 500 10 {
[$replica dbsize] eq 1 [s evicted_keys] eq 3
} else { } else {
fail "Not all keys have been evicted" fail "Not all keys have been evicted"
} }
...@@ -207,14 +208,14 @@ tags "modules" { ...@@ -207,14 +208,14 @@ tags "modules" {
test {module propagation with timer and CONFIG SET maxmemory} { test {module propagation with timer and CONFIG SET maxmemory} {
set repl [attach_to_replication_stream] set repl [attach_to_replication_stream]
$master config resetstat
$master config set maxmemory-policy volatile-random $master config set maxmemory-policy volatile-random
$master propagate-test.timer-maxmemory $master propagate-test.timer-maxmemory
# The replica will have two keys: "notifications" and "timer-maxmemory-middle" # Wait until the volatile keys are evicted
# which are not volatile
wait_for_condition 500 10 { wait_for_condition 500 10 {
[$replica dbsize] eq 2 [s evicted_keys] eq 2
} else { } else {
fail "Not all keys have been evicted" fail "Not all keys have been evicted"
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment