Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
rbd-mirror A/A: coordinate image syncs with leader #14745
My original thinking was that these messages would be part of
InstanceWatcher since that would allow direct RPC between the instance requesting the sync and the leader that can grant it. Sending the RPC via the
LeaderWatcher would result in a broadcast message.
InstanceWatcher already has the notion of repeating messages until acked which seems like it could be re-used here. Also, I think you would be able to eliminate the listener pattern by instantiating the
InstanceSyncThrottler when the leader is acquired and by passing the pointer to
InstanceWatcher (and clearing it when the leader role is lost).
@dillaman Thank you for the review. Using
@trociny I think the optimization to directly pass-through image sync requests for the local leader's images might be adding undo complications. The code complexity would most likely be reduced if we just eliminated all those special cases and just send the message and allowed it to be received back by the watcher.
@dillaman Here is a new version. The main changes:
Some details for the last item. Now, when requesting a sync slot, the instance sends SyncRequest messages and waits for ack (resending after timeout). When the leader throttler grants the sync slot, the SyncRequest is acked and the leader sends SyncStart message (resending after timeout until it is acked). The SyncStart is acked by the instance when the sync is complete.
A situation is possible, when the leader receives a duplicate 'SyncRequest' resent after timeout, after it has already granted the sync slot and sent 'SyncStart'. In this case a duplicate 'SyncStart' will be sent, which is handled on the receiver side by completing the previous 'SyncStart' with -ESTALE.
In this scheme it looks like 'SyncComplete' notifications are not necessary and just lead to duplicate sync throttler finish_op. It looks I may remove them, so