Hi, @antirez i have read the doc about Replication. In section read-only slave i have read about that when configure slave instance for write. all the write to slave instance will be discarded in case of master syncing and slave restart.
You may wonder why it is possible to revert the read-only setting and have slave instances that can be target of write operations. While those writes will be discarded if the slave and the master resynchronize or if the slave is restarted, there are a few legitimate use case for storing ephemeral data in writable slaves. However in the future it is possible that this feature will be dropped.
But, i have test that in redis 3.2.0 the phenomenon is not true. The setted keys in slave will not be lost in syncing from master. So, i think may be the doc is too old.
Comment From: francis-shuoch
Hi, I happened to be walking through the codebase, and I just found that in current unstable branch, the rule is not changed. See https://github.com/antirez/redis/blob/unstable/src/replication.c#L1110. The function emptyDb() is stilled called on slave after new RDB is transferred from master. So the whole db on slave is flushed. I didn't spot any read-only specific code in replication implementation (in replication.c), the only usage I searched is acting as a gateway in discarding write commands, https://github.com/antirez/redis/blob/unstable/src/server.c#L2479, nothing more. So read-only or not won't change this behavior.
So my guess is you might encounter some data delay. Hope my comments can be helpful ;)