summaryrefslogtreecommitdiff
path: root/src/tracking.c
diff options
context:
space:
mode:
authorHuang Zhw <huang_zhw@126.com>2022-07-31 21:14:39 +0800
committerGitHub <noreply@github.com>2022-07-31 16:14:39 +0300
commit61451b02cb3dd5f274a2f5fe72bf0b80b02a744e (patch)
tree920e879e10b74add8878deef39e8d7f8d1b32f71 /src/tracking.c
parent90f35cea81b48834cf3906435a2ef352f3e3e900 (diff)
downloadredis-61451b02cb3dd5f274a2f5fe72bf0b80b02a744e.tar.gz
tracking pending invalidation message of flushdb sent by (#11068)
trackingHandlePendingKeyInvalidations should use proto.
Diffstat (limited to 'src/tracking.c')
-rw-r--r--src/tracking.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tracking.c b/src/tracking.c
index c98421edb..7dc025068 100644
--- a/src/tracking.c
+++ b/src/tracking.c
@@ -423,9 +423,15 @@ void trackingHandlePendingKeyInvalidations() {
robj *key = listNodeValue(ln);
/* current_client maybe freed, so we need to send invalidation
* message only when current_client is still alive */
- if (server.current_client != NULL)
- sendTrackingMessage(server.current_client,(char *)key->ptr,sdslen(key->ptr),0);
- decrRefCount(key);
+ if (server.current_client != NULL) {
+ if (key != NULL) {
+ sendTrackingMessage(server.current_client,(char *)key->ptr,sdslen(key->ptr),0);
+ } else {
+ sendTrackingMessage(server.current_client,shared.null[server.current_client->resp]->ptr,
+ sdslen(shared.null[server.current_client->resp]->ptr),1);
+ }
+ }
+ if (key != NULL) decrRefCount(key);
}
listEmpty(server.tracking_pending_keys);
}
@@ -455,8 +461,8 @@ void trackingInvalidateKeysOnFlush(int async) {
client *c = listNodeValue(ln);
if (c->flags & CLIENT_TRACKING) {
if (c == server.current_client) {
- incrRefCount(shared.null[c->resp]);
- listAddNodeTail(server.tracking_pending_keys,shared.null[c->resp]);
+ /* We use a special NULL to indicate that we should send null */
+ listAddNodeTail(server.tracking_pending_keys,NULL);
} else {
sendTrackingMessage(c,shared.null[c->resp]->ptr,sdslen(shared.null[c->resp]->ptr),1);
}