diff options
-rw-r--r-- | src/tracking.c | 2 | ||||
-rw-r--r-- | tests/unit/tracking.tcl | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/tracking.c b/src/tracking.c index f472309f6..d6f2bf149 100644 --- a/src/tracking.c +++ b/src/tracking.c @@ -326,7 +326,7 @@ void trackingRememberKeyToBroadcast(client *c, char *keyname, size_t keylen) { * tree. This way we know who was the client that did the last * change to the key, and can avoid sending the notification in the * case the client is in NOLOOP mode. */ - raxTryInsert(bs->keys,(unsigned char*)keyname,keylen,c,NULL); + raxInsert(bs->keys,(unsigned char*)keyname,keylen,c,NULL); } raxStop(&ri); } diff --git a/tests/unit/tracking.tcl b/tests/unit/tracking.tcl index 3cd6fd5aa..8e51a3e57 100644 --- a/tests/unit/tracking.tcl +++ b/tests/unit/tracking.tcl @@ -132,6 +132,22 @@ start_server {tags {"tracking network"}} { assert {$keys eq {mykey}} } + test {Tracking gets notification of lazy expired keys} { + r CLIENT TRACKING off + r CLIENT TRACKING on BCAST REDIRECT $redir_id NOLOOP + # Use multi-exec to expose a race where the key gets an two invalidations + # in the same event loop, once by the client so filtered by NOLOOP, and + # the second one by the lazy expire + r MULTI + r SET mykey{t} myval px 1 + r SET mykeyotherkey{t} myval ; # We should not get it + r DEBUG SLEEP 0.1 + r GET mykey{t} + r EXEC + set keys [lsort [lindex [$rd_redirection read] 2]] + assert {$keys eq {mykey{t}}} + } {} {needs:debug} + test {HELLO 3 reply is correct} { set reply [r HELLO 3] assert_equal [dict get $reply proto] 3 |