summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-01-08 13:09:48 +0100
committerGitHub <noreply@github.com>2020-01-08 13:09:48 +0100
commitf616ecf361d673e750c940cc67d19a1e21b1db20 (patch)
treec870cb53e5138bff35b93b79dc83f074bf70aef5
parent2ee4f9f34e66b30d0623f1adb6a860860891f94d (diff)
parent0c898bdb07e7d5716db7a3b311a1d7586ffbdca0 (diff)
downloadredis-f616ecf361d673e750c940cc67d19a1e21b1db20.tar.gz
Merge pull request #6698 from yossigo/ctx-flags-multi-dirty
Add REDISMODULE_CTX_FLAGS_MULTI_DIRTY.
-rw-r--r--src/module.c6
-rw-r--r--src/redismodule.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c
index 705ffec2c..965bb4460 100644
--- a/src/module.c
+++ b/src/module.c
@@ -1842,6 +1842,12 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
flags |= REDISMODULE_CTX_FLAGS_REPLICATED;
}
+ /* For DIRTY flags, we need the blocked client if used */
+ client *c = ctx->blocked_client ? ctx->blocked_client->client : ctx->client;
+ if (c && (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC))) {
+ flags |= REDISMODULE_CTX_FLAGS_MULTI_DIRTY;
+ }
+
if (server.cluster_enabled)
flags |= REDISMODULE_CTX_FLAGS_CLUSTER;
diff --git a/src/redismodule.h b/src/redismodule.h
index 57f98fb93..637078f2b 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -110,6 +110,8 @@
#define REDISMODULE_CTX_FLAGS_REPLICA_IS_ONLINE (1<<17)
/* There is currently some background process active. */
#define REDISMODULE_CTX_FLAGS_ACTIVE_CHILD (1<<18)
+/* The next EXEC will fail due to dirty CAS (touched keys). */
+#define REDISMODULE_CTX_FLAGS_MULTI_DIRTY (1<<19)
/* Keyspace changes notification classes. Every class is associated with a
* character for configuration purposes.