summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-05-14 11:27:31 +0200
committerantirez <antirez@gmail.com>2020-05-14 11:27:31 +0200
commitdec6fd3adc59ecb6e3dc8320c448e9f20ea00b9d (patch)
tree6cb0e05fffc5e9148d52229762f6289ecc95409b
parent3e6acc24d6e00c7ca14e02bf7e81a8650f48f63a (diff)
downloadredis-dec6fd3adc59ecb6e3dc8320c448e9f20ea00b9d.tar.gz
Regression test for #7249.
-rw-r--r--tests/unit/tracking.tcl22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/tracking.tcl b/tests/unit/tracking.tcl
index 43bb5f864..0332fa726 100644
--- a/tests/unit/tracking.tcl
+++ b/tests/unit/tracking.tcl
@@ -107,5 +107,27 @@ start_server {tags {"tracking"}} {
assert {$keys eq {mykey}}
}
+ test {Tracking gets notification on tracking table key eviction} {
+ r CLIENT TRACKING off
+ r CLIENT TRACKING on REDIRECT $redir NOLOOP
+ r MSET key1 1 key2 2
+ # Let the server track the two keys for us
+ r MGET key1 key2
+ # Force the eviction of all the keys but one:
+ r config set tracking-table-max-keys 1
+ # Note that we may have other keys in the table for this client,
+ # since we disabled/enabled tracking multiple time with the same
+ # ID, and tracking does not do ID cleanups for performance reasons.
+ # So we check that eventually we'll receive one or the other key,
+ # otherwise the test will die for timeout.
+ while 1 {
+ set keys [lindex [$rd1 read] 2]
+ if {$keys eq {key1} || $keys eq {key2}} break
+ }
+ # We should receive an expire notification for one of
+ # the two keys (only one must remain)
+ assert {$keys eq {key1} || $keys eq {key2}}
+ }
+
$rd1 close
}