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.
This commit is contained in:
Binbin 2022-02-23 14:47:16 +08:00 committed by GitHub
parent de6be8850f
commit 488aecb3ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,20 +132,24 @@ start_server {tags {"multi"}} {
} {} {cluster:skip}
test {EXEC fail on lazy expired WATCHed key} {
r flushall
r del key
r debug set-active-expire 0
r del key
r set key 1 px 2
r watch key
for {set j 0} {$j < 10} {incr j} {
r set key 1 px 100
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
} {OK} {needs:debug}
set _ $res
} {} {needs:debug}
test {WATCH stale keys should not fail EXEC} {
r del x