I'm trying to experiment with one master Redis instance and one replica. Both master and replica node is configured to avoid persistence.
At master, disk-backed replication is enabled, which is by default. Therefore when replica node requests for synchronization, master node creates a rdb file sends to the replica. Replica node loads this into it's memory.
As per the excerpt from the Redis replication document (https://redis.io/topics/replication)
It is possible to use replication to avoid the cost of having the master writing the full dataset to disk: a typical technique involves configuring your master redis.conf to avoid persisting to disk at all, then connect a slave configured to save from time to time, or with AOF enabled. However this setup must be handled with care, since a restarting master will start with an empty dataset: if the slave tries to synchronized with it, the slave will be emptied as well.
Hence as per this notes, when master node is restarted, it is supposed to have an empty dataset. But the observation is when the 2nd node issued a sync request earlier, both master and replica Redis node had rdb file saved as part of disk backed replication and now when the master restarts it loads this RDB file.
This statement therefore is little ambiguous. Is this a limitation in Redis or a configuration issue?
Thanks
Comment From: trevor211
I think what the document says in this case is that you should config your master with diskless replication.
Comment From: oranagra
@rajanarayan92 what you say is that your save configuration is empty, so a shutdown doesn't save the data to an RDB, but you do have a dbfilename config, and an old rdb file on the disk from past replication, so when server restarted which you intended to come up empty, came up with the old data?
diskless replication was not meant to prevent such a case.
maybe we need a new load-on-startup config? or avoid loading if save is not configured.
p.s. the new rdb-del-sync-files, can possibly help here a bit (but still, i consider it a side effect)