EXISTS should not alter LRU, OBJECT should not reveal expired keys#8016
EXISTS should not alter LRU, OBJECT should not reveal expired keys#8016oranagra merged 2 commits intoredis:unstablefrom
Conversation
Bug was intoduced by redis#5021. Before that commit, dbExists was used instead of lookupKeyRead (which affects access time)
|
@soloestoy FYI |
|
speaking of which, maybe other commands should not affect access time? OBJECT? |
|
I don't object to cleaning the stables and locating more commands that violate this principle, but unless introduced by accident like in this case, we have to consider the (skewed) use case of someone actually doing |
|
Have a question about I understand the |
|
@soloestoy yes, that's a grey area in Redis... Maybe it's time to formalize it: I suggest that any command that doesn't access the data of a key should not affect LRU/LFU. Except TOUCH. |
|
I think SCAN (checking that the key didn't expire) and EXIST are kinda obvious that they should not touch the LRU. Note that OBJECT uses dictFind right now, but i think it better use I think DEBUG DIGEST-VALUE should be changed to be like DEBUG OBJECT, and use dictFind directly. Not sure about TTL and EXPIRE (which i suppose should behave similarly in that respect), maybe TTL should be changed to touch the LRU. |
|
BTW, besides the access time, if key doesn't exist |
|
So we can add a flag named We can also add a |
6d2bcf2
|
@redis/core-team pushed another commit fixing DEBUG digest-value (to handle expired keys) and OBJECT (to avoid handling expired keys) the only thing left to decide is whether EXPIRE command(s) affect LRU/LFU |
|
I agree with @guybe7's gut |
|
[deleted my last message since it stated incorrect facts, here's the updated one] i tend to agree.. (keep EXPIRE as it is, which is to "thouch" the LRU/LFU).
So this means that if we agree, this PR is ready to be merged.
@redis/core-team please approve. or state what you think about EXPIRE's behavior. |
|
Agreed about not changing the existing touchy |
yossigo
left a comment
There was a problem hiding this comment.
I agree about EXPIRE touching the key. I think it makes sense for metadata introspection to not touch LRU, but metadata modification should touch it.
|
Note: the commit comment that was merged was wrong, in the sense that it indicated that the effect of the change in OBJECT is only on replica, but in fact the change affects master too. |
… replica (redis#8016) The bug was introduced by redis#5021 which only attempted avoid EXIST on an already expired key from returning 1 on a replica. Before that commit, dbExists was used instead of lookupKeyRead (which had an undesired effect to "touch" the LRU/LFU) Other than that, this commit fixes OBJECT to also come empty handed on expired keys in replica. And DEBUG DIGEST-VALUE to behave like DEBUG OBJECT (get the data from the key regardless of it's expired state)
… replica (#8016) The bug was introduced by #5021 which only attempted avoid EXIST on an already expired key from returning 1 on a replica. Before that commit, dbExists was used instead of lookupKeyRead (which had an undesired effect to "touch" the LRU/LFU) Other than that, this commit fixes OBJECT to also come empty handed on expired keys in replica. And DEBUG DIGEST-VALUE to behave like DEBUG OBJECT (get the data from the key regardless of it's expired state) (cherry picked from commit f8ae991)
Bug was intoduced by #5021.
Before that commit, dbExists was used instead of
lookupKeyRead (which affects access time)