summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjudeng <abc3844@126.com>2023-02-20 16:23:25 +0800
committerGitHub <noreply@github.com>2023-02-20 10:23:25 +0200
commit40659c342487fba6ef98444c7b9bb6cad9794f18 (patch)
tree4f3c0a96eee97932d06d7ed2d62c383873e321b0 /tests
parent3ac835777cf835caf79022e44030cc724fd79ce4 (diff)
downloadredis-40659c342487fba6ef98444c7b9bb6cad9794f18.tar.gz
add test case and comments for active expiry in the writeable replica (#11789)
This test case is to cover a edge scenario: when a writable replica enabled AOF at the same time, active expiry keys which was created in writable replicas should propagate to the AOF file, and some versions might crash (fixed by #11615). For details, please refer to #11778
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/expire.tcl17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit/expire.tcl b/tests/unit/expire.tcl
index e23e2a89a..22a9f73bb 100644
--- a/tests/unit/expire.tcl
+++ b/tests/unit/expire.tcl
@@ -571,6 +571,23 @@ start_server {tags {"expire"}} {
assert_equal [$primary pexpiretime $key] [$replica pexpiretime $key]
}
}
+
+ test {expired key which is created in writeable replicas should be deleted by active expiry} {
+ $primary flushall
+ $replica config set replica-read-only no
+ foreach {yes_or_no} {yes no} {
+ $replica config set appendonly $yes_or_no
+ waitForBgrewriteaof $replica
+ set prev_expired [s expired_keys]
+ $replica set foo bar PX 1
+ wait_for_condition 100 10 {
+ [s expired_keys] eq $prev_expired + 1
+ } else {
+ fail "key not expired"
+ }
+ assert_equal {} [$replica get foo]
+ }
+ }
}
test {SET command will remove expire} {