summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/expire.c3
-rw-r--r--tests/unit/expire.tcl17
2 files changed, 19 insertions, 1 deletions
diff --git a/src/expire.c b/src/expire.c
index d07e22f66..425491af6 100644
--- a/src/expire.c
+++ b/src/expire.c
@@ -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();
}
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} {