antirez/redis — Issue #245: Possible problems with AOF used in slaves
Author: antirez
Created: 2011-12-13 18:21:44+00:00
State: open
Labels: 2.4 merge candidate, critical bug

There are a few of interactions about AOF used by Redis slave instances that should be investigated better before the release of Redis 2.6. The fixes should be backported to Redis 2.4 if possible.

* When a slave successfully synchs with its master, and AOF is enabled, an AOF rewrite gets triggered. What happens if the AOF rewrite was already in progress? Probably the new rewrite fails to be started. The correct solution is to kill the old child and spawn a new one.
* An instance was a master with its AOF, or that was a slave with its AOF, and is now perform a synchronization with a new master, or with the same master after a link down. Now the instance just finished to perform the synchronization, and triggers the rewrite, that spawns a child, and so forth. In the meantime write queries will arrive from the master: where they end being written? In the old AOF that is about a different data set entirely? That's completely broken. Once a slave successfully performs a remote sync it should remove the old AOF at all unlinking it and reopening it. Then no new data should be written to the AOF before the rewrite of the AOF is not finished.
* Improve logging of what happens when write(2) against the AOF fails.