Unverified Commit 40659c34 authored by judeng's avatar judeng Committed by GitHub
Browse files

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 
parent 3ac83577
......@@ -385,7 +385,8 @@ void expireSlaveKeys(void) {
activeExpireCycleTryExpire(server.db+dbid,expire,start))
{
expired = 1;
/* DELs aren't propagated, but modules may want their hooks. */
/* Propagate the DEL (writable replicas do not propagate anything to other replicas,
* but they might propagate to AOF) and trigger module hooks. */
postExecutionUnitOperations();
}
......
......@@ -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} {
......
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