Commit ec5564a4 authored by DarrenJiang13's avatar DarrenJiang13 Committed by Oran Agra
Browse files

fix the client type in trackingInvalidateKey() (#11052)

Fix bug with scripts ignoring client tracking NOLOOP and
send an invalidation message anyway.

(cherry picked from commit 44859a41)
parent 2cd5f6f3
...@@ -381,7 +381,7 @@ void trackingInvalidateKey(client *c, robj *keyobj, int bcast) { ...@@ -381,7 +381,7 @@ void trackingInvalidateKey(client *c, robj *keyobj, int bcast) {
/* If the client enabled the NOLOOP mode, don't send notifications /* If the client enabled the NOLOOP mode, don't send notifications
* about keys changed by the client itself. */ * about keys changed by the client itself. */
if (target->flags & CLIENT_TRACKING_NOLOOP && if (target->flags & CLIENT_TRACKING_NOLOOP &&
target == c) target == server.current_client)
{ {
continue; continue;
} }
......
...@@ -208,6 +208,19 @@ start_server {tags {"tracking network"}} { ...@@ -208,6 +208,19 @@ start_server {tags {"tracking network"}} {
assert {$res eq {key1}} assert {$res eq {key1}}
} }
test {Invalid keys should not be tracked for scripts in NOLOOP mode} {
$rd_sg CLIENT TRACKING off
$rd_sg CLIENT TRACKING on NOLOOP
$rd_sg HELLO 3
$rd_sg SET key1 1
assert_equal "1" [$rd_sg GET key1]
# For write command in script, invalid key should not be tracked with NOLOOP flag
$rd_sg eval "return redis.call('set', 'key1', '2')" 1 key1
assert_equal "2" [$rd_sg GET key1]
$rd_sg CLIENT TRACKING off
}
test {RESP3 Client gets tracking-redir-broken push message after cached key changed when rediretion client is terminated} { test {RESP3 Client gets tracking-redir-broken push message after cached key changed when rediretion client is terminated} {
r CLIENT TRACKING on REDIRECT $redir_id r CLIENT TRACKING on REDIRECT $redir_id
$rd_sg SET key1 1 $rd_sg SET key1 1
......
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