WATCH no longer ignores keys which have expired for MULTI/EXEC. (#7920)

This wrong behavior was backed by a test, and also documentation, and dates back to 2010.
But it makes no sense to anyone involved so it was decided to change that.

Note that 3b031b1 (invalidate watch on expire on access) was released in 6.0 RC2
and 62a3ec8 released in in 6.0.0 GA (invalidate watch when key is evicted).
both of which do similar changes.
This commit is contained in:
Qu Chen 2020-10-22 02:57:45 -07:00 committed by GitHub
parent 33c59266cc
commit 44bcbed2ee
2 changed files with 3 additions and 3 deletions

View File

@ -64,7 +64,7 @@ int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) {
dbSyncDelete(db,keyobj); dbSyncDelete(db,keyobj);
notifyKeyspaceEvent(NOTIFY_EXPIRED, notifyKeyspaceEvent(NOTIFY_EXPIRED,
"expired",keyobj,db->id); "expired",keyobj,db->id);
trackingInvalidateKey(NULL,keyobj); signalModifiedKey(NULL, db, keyobj);
decrRefCount(keyobj); decrRefCount(keyobj);
server.stat_expiredkeys++; server.stat_expiredkeys++;
return 1; return 1;

View File

@ -221,7 +221,7 @@ start_server {tags {"multi"}} {
r exec r exec
} {} } {}
test {WATCH will not consider touched expired keys} { test {WATCH will consider touched expired keys} {
r del x r del x
r set x foo r set x foo
r expire x 1 r expire x 1
@ -230,7 +230,7 @@ start_server {tags {"multi"}} {
r multi r multi
r ping r ping
r exec r exec
} {PONG} } {}
test {DISCARD should clear the WATCH dirty flag on the client} { test {DISCARD should clear the WATCH dirty flag on the client} {
r watch x r watch x