dragonfly
dragonfly copied to clipboard
Support partial sync in replication
When the link between the master and the replica breaks, for network issues or because a timeout is sensed in the master or the replica, the replica reconnects and attempts to proceed with a partial resynchronization: it means that it will try to just obtain the part of the stream of commands it missed during the disconnection. When a partial resynchronization is not possible, the replica will ask for a full resynchronization. This will involve a more complex process in which the master needs to create a snapshot of all its data, send it to the replica, and then continue sending the stream of commands as the dataset changes.
Note: We'll need a distinction between #executed and #read, because entries can be executed out of order. Partial sync needs to be based on #read, while lag and consistency is (#read - #executed).