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
This commit is contained in:
parent
3ac835777c
commit
40659c3424
@ -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} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user