summaryrefslogtreecommitdiff
path: root/src/blocked.c
diff options
context:
space:
mode:
authorViktor Söderqvist <viktor.soderqvist@est.tech>2021-11-28 10:26:28 +0100
committerGitHub <noreply@github.com>2021-11-28 11:26:28 +0200
commitacf3495eb823df8d1f358b1fe59b759fcc49666f (patch)
treed4975294079d9458ce7203289a1f1473bd68ed9f /src/blocked.c
parent4d8700786e2f198f9ef44961196122bbb80ee640 (diff)
downloadredis-acf3495eb823df8d1f358b1fe59b759fcc49666f.tar.gz
Sort out the mess around writable replicas and lookupKeyRead/Write (#9572)
Writable replicas now no longer use the values of expired keys. Expired keys are deleted when lookupKeyWrite() is used, even on a writable replica. Previously, writable replicas could use the value of an expired key in write commands such as INCR, SUNIONSTORE, etc.. This commit also sorts out the mess around the functions lookupKeyRead() and lookupKeyWrite() so they now indicate what we intend to do with the key and are not affected by the command calling them. Multi-key commands like SUNIONSTORE, ZUNIONSTORE, COPY and SORT with the store option now use lookupKeyRead() for the keys they're reading from (which will not allow reading from logically expired keys). This commit also fixes a bug where PFCOUNT could return a value of an expired key. Test modules commands have their readonly and write flags updated to correctly reflect their lookups for reading or writing. Modules are not required to correctly reflect this in their command flags, but this change is made for consistency since the tests serve as usage examples. Fixes #6842. Fixes #7475.
Diffstat (limited to 'src/blocked.c')
-rw-r--r--src/blocked.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/blocked.c b/src/blocked.c
index 3723b4fbf..a554e863b 100644
--- a/src/blocked.c
+++ b/src/blocked.c
@@ -591,8 +591,7 @@ void handleClientsBlockedOnKeys(void) {
updateCachedTime(0);
/* Serve clients blocked on the key. */
- robj *o = lookupKeyWrite(rl->db,rl->key);
-
+ robj *o = lookupKeyReadWithFlags(rl->db, rl->key, LOOKUP_NONOTIFY | LOOKUP_NOSTATS);
if (o != NULL) {
if (o->type == OBJ_LIST)
serveClientsBlockedOnListKey(o,rl);