summaryrefslogtreecommitdiff
path: root/src/tracking.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-02-14 14:17:10 +0100
committerantirez <antirez@gmail.com>2020-02-14 14:27:43 +0100
commitf6e32a832f4aaa92721f4ea1eadc1d3897ba32c2 (patch)
tree2975997c7cace40f8c88b9f55cb9544421b905f9 /src/tracking.c
parent6922ccc0b98156e787b3d2f35daf0299e7844250 (diff)
downloadredis-f6e32a832f4aaa92721f4ea1eadc1d3897ba32c2.tar.gz
Tracking: fix behavior when switchinig from normal to BCAST.
Diffstat (limited to 'src/tracking.c')
-rw-r--r--src/tracking.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tracking.c b/src/tracking.c
index ef5840863..3333472a4 100644
--- a/src/tracking.c
+++ b/src/tracking.c
@@ -269,7 +269,17 @@ void trackingInvalidateKey(robj *keyobj) {
uint64_t id;
memcpy(&id,ri.key,sizeof(id));
client *c = lookupClientByID(id);
- if (c == NULL || !(c->flags & CLIENT_TRACKING)) continue;
+ /* Note that if the client is in BCAST mode, we don't want to
+ * send invalidation messages that were pending in the case
+ * previously the client was not in BCAST mode. This can happen if
+ * TRACKING is enabled normally, and then the client switches to
+ * BCAST mode. */
+ if (c == NULL ||
+ !(c->flags & CLIENT_TRACKING)||
+ c->flags & CLIENT_TRACKING_BCAST)
+ {
+ continue;
+ }
sendTrackingMessage(c,sdskey,sdslen(sdskey),0);
}
raxStop(&ri);