Unverified Commit 488aecb3 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix timing issue in EXEC fail on lazy expired WATCHed key test (#10332)

The test will fail on slow machines (valgrind or FreeBsd).
Because in #10256 when WATCH is called on a key that's already
logically expired, we will add an `expired` flag, and we will
skip it in `isWatchedKeyExpired` check.

Apparently we need to increase the expiration time so that
the key can not expire logically then the WATCH is called.
Also added retries to make sure it doesn't fail. I suppose
100ms is enough in valgrind, tested locally, no need to retry.
parent de6be885
...@@ -132,20 +132,24 @@ start_server {tags {"multi"}} { ...@@ -132,20 +132,24 @@ start_server {tags {"multi"}} {
} {} {cluster:skip} } {} {cluster:skip}
test {EXEC fail on lazy expired WATCHed key} { test {EXEC fail on lazy expired WATCHed key} {
r flushall r del key
r debug set-active-expire 0 r debug set-active-expire 0
r del key for {set j 0} {$j < 10} {incr j} {
r set key 1 px 2 r set key 1 px 100
r watch key r watch key
after 101
r multi
r incr key
after 100 set res [r exec]
if {$res eq {}} break
}
if {$::verbose} { puts "EXEC fail on lazy expired WATCHed key attempts: $j" }
r multi
r incr key
assert_equal [r exec] {}
r debug set-active-expire 1 r debug set-active-expire 1
} {OK} {needs:debug} set _ $res
} {} {needs:debug}
test {WATCH stale keys should not fail EXEC} { test {WATCH stale keys should not fail EXEC} {
r del x r del x
......
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