summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Benoish <guy.benoish@redislabs.com>2020-02-03 15:19:44 +0530
committerGuy Benoish <guy.benoish@redislabs.com>2020-02-03 15:43:44 +0530
commit2fda5f5c98ca0f0ce426c7dff3951804db62e0fe (patch)
treef1f6c1954c4e1dc0f4ae53177ebd83e9b3a1c650
parentbf53f9280a7068ea80a47ccdc0fe9d50258e0612 (diff)
downloadredis-2fda5f5c98ca0f0ce426c7dff3951804db62e0fe.tar.gz
Exclude "keymiss" notification from NOTIFY_ALL
Because "keymiss" is "special" compared to the rest of the notifications (Trying not to break existing apps using the 'A' format for notifications) Also updated redis.conf and module.c docs
-rw-r--r--redis.conf6
-rw-r--r--src/module.c3
-rw-r--r--src/notify.c2
-rw-r--r--src/redismodule.h4
-rw-r--r--src/server.h4
5 files changed, 12 insertions, 7 deletions
diff --git a/redis.conf b/redis.conf
index 07005cffe..2b8711eea 100644
--- a/redis.conf
+++ b/redis.conf
@@ -1362,7 +1362,11 @@ latency-monitor-threshold 0
# z Sorted set commands
# x Expired events (events generated every time a key expires)
# e Evicted events (events generated when a key is evicted for maxmemory)
-# A Alias for g$lshzxe, so that the "AKE" string means all the events.
+# t Stream commands
+# m Key-miss events (Note: It is not included in the 'A' class)
+# A Alias for g$lshzxet, so that the "AKE" string means all the events
+# (Except key-miss events which are excluded from 'A' due to their
+# unique nature).
#
# The "notify-keyspace-events" takes as argument a string that is composed
# of zero or multiple characters. The empty string means that notifications
diff --git a/src/module.c b/src/module.c
index d2b267be2..54072af57 100644
--- a/src/module.c
+++ b/src/module.c
@@ -4798,7 +4798,8 @@ void moduleReleaseGIL(void) {
* - REDISMODULE_NOTIFY_EXPIRED: Expiration events
* - REDISMODULE_NOTIFY_EVICTED: Eviction events
* - REDISMODULE_NOTIFY_STREAM: Stream events
- * - REDISMODULE_NOTIFY_ALL: All events
+ * - REDISMODULE_NOTIFY_KEYMISS: Key-miss events
+ * - REDISMODULE_NOTIFY_ALL: All events (Excluding REDISMODULE_NOTIFY_KEYMISS)
*
* We do not distinguish between key events and keyspace events, and it is up
* to the module to filter the actions taken based on the key.
diff --git a/src/notify.c b/src/notify.c
index d6c3ad403..bb1055724 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -82,10 +82,10 @@ sds keyspaceEventsFlagsToString(int flags) {
if (flags & NOTIFY_EXPIRED) res = sdscatlen(res,"x",1);
if (flags & NOTIFY_EVICTED) res = sdscatlen(res,"e",1);
if (flags & NOTIFY_STREAM) res = sdscatlen(res,"t",1);
- if (flags & NOTIFY_KEY_MISS) res = sdscatlen(res,"m",1);
}
if (flags & NOTIFY_KEYSPACE) res = sdscatlen(res,"K",1);
if (flags & NOTIFY_KEYEVENT) res = sdscatlen(res,"E",1);
+ if (flags & NOTIFY_KEY_MISS) res = sdscatlen(res,"m",1);
return res;
}
diff --git a/src/redismodule.h b/src/redismodule.h
index 637078f2b..e74611f13 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -127,8 +127,8 @@
#define REDISMODULE_NOTIFY_EXPIRED (1<<8) /* x */
#define REDISMODULE_NOTIFY_EVICTED (1<<9) /* e */
#define REDISMODULE_NOTIFY_STREAM (1<<10) /* t */
-#define REDISMODULE_NOTIFY_KEY_MISS (1<<11) /* m */
-#define REDISMODULE_NOTIFY_ALL (REDISMODULE_NOTIFY_GENERIC | REDISMODULE_NOTIFY_STRING | REDISMODULE_NOTIFY_LIST | REDISMODULE_NOTIFY_SET | REDISMODULE_NOTIFY_HASH | REDISMODULE_NOTIFY_ZSET | REDISMODULE_NOTIFY_EXPIRED | REDISMODULE_NOTIFY_EVICTED | REDISMODULE_NOTIFY_STREAM | REDISMODULE_NOTIFY_KEY_MISS) /* A */
+#define REDISMODULE_NOTIFY_KEY_MISS (1<<11) /* m (Note: This one is excluded from REDISMODULE_NOTIFY_ALL on purpose) */
+#define REDISMODULE_NOTIFY_ALL (REDISMODULE_NOTIFY_GENERIC | REDISMODULE_NOTIFY_STRING | REDISMODULE_NOTIFY_LIST | REDISMODULE_NOTIFY_SET | REDISMODULE_NOTIFY_HASH | REDISMODULE_NOTIFY_ZSET | REDISMODULE_NOTIFY_EXPIRED | REDISMODULE_NOTIFY_EVICTED | REDISMODULE_NOTIFY_STREAM) /* A */
/* A special pointer that we can use between the core and the module to signal
diff --git a/src/server.h b/src/server.h
index 8e354c03d..257f22985 100644
--- a/src/server.h
+++ b/src/server.h
@@ -413,8 +413,8 @@ typedef long long ustime_t; /* microsecond time type. */
#define NOTIFY_EXPIRED (1<<8) /* x */
#define NOTIFY_EVICTED (1<<9) /* e */
#define NOTIFY_STREAM (1<<10) /* t */
-#define NOTIFY_KEY_MISS (1<<11) /* m */
-#define NOTIFY_ALL (NOTIFY_GENERIC | NOTIFY_STRING | NOTIFY_LIST | NOTIFY_SET | NOTIFY_HASH | NOTIFY_ZSET | NOTIFY_EXPIRED | NOTIFY_EVICTED | NOTIFY_STREAM | NOTIFY_KEY_MISS) /* A flag */
+#define NOTIFY_KEY_MISS (1<<11) /* m (Note: This one is excluded from NOTIFY_ALL on purpose) */
+#define NOTIFY_ALL (NOTIFY_GENERIC | NOTIFY_STRING | NOTIFY_LIST | NOTIFY_SET | NOTIFY_HASH | NOTIFY_ZSET | NOTIFY_EXPIRED | NOTIFY_EVICTED | NOTIFY_STREAM) /* A flag */
/* Get the first bind addr or NULL */
#define NET_FIRST_BIND_ADDR (server.bindaddr_count ? server.bindaddr[0] : NULL)