You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order for Redis to ensure consistency between a master and its slaves, eviction of keys with an expire are managed by the master, which sends an explicit DEL to its slaves when the key gets actually removed.
This means that slaves are not able to directly expire keys, even if these keys are logically expired on the master side. So a GET that will return null in the master side, may return a stale value in the slave side.
This is a limit when using slaves in order to scale reads. Also the behavior does not require to be as global as it is currently. Normally slaves are configured in a read-only fashion, so they can only accept read commands from normal clients, and write commands from the master.
lookupKeyRead() may be modified in order to return NULL in the context of a slave, if the current client is not the master, even if it will not actually evict the key from the key space.
To implement this we could resort to two APIs:
expireIfNeeded() in the context of slaves don't really try to evict expired keys, but just returns a return-value to signal if the key should be expired according to our local clock.
server.current_client could be used in order to test if the current client is our master.
A more in depth analysis is needed, but likely just using this simple checks we could be able to have a more sane semantics of read commands on slaves in a safe way.
I just checked that the issue persists on 3.04(stable) version. Checked the source, patch was never merged. Just wondering if we are actually planning to resolve the issue. Logically slaves are not consistent with master which is quite dangerous.
Hello, it was merged in the context of Redis 3.2 that will go RC before end of the year. No way we can put this into 3.0, too big semantical change. Thanks.
Activity
antirez commentedon Dec 10, 2014
Fixed in 06e76bc.
Better read-only behavior for expired keys in slaves.
mangatmodi commentedon Oct 1, 2015
I just checked that the issue persists on 3.04(stable) version. Checked the source, patch was never merged. Just wondering if we are actually planning to resolve the issue. Logically slaves are not consistent with master which is quite dangerous.
sirdawidd commentedon Oct 27, 2015
There is some chance that it will be merged?
antirez commentedon Oct 27, 2015
Hello, it was merged in the context of Redis 3.2 that will go RC before end of the year. No way we can put this into 3.0, too big semantical change. Thanks.
antirez commentedon Oct 27, 2015
p.s. Redis 3.2 branch name is
testing.zagfai commentedon Aug 15, 2016
Yes a big problem with limit explanation on documents.