forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Remote Clone Flow
Laurynas Biveinis edited this page Dec 12, 2022
·
17 revisions
In remote clone, client and donor are separate instances communicating through network.
The clone plugin defines and uses a RPC protocol with several COM_
commands. The storage engine interface does not deal with them directly, the map to the same handlerton API as the local clone which does not use the RPC protocol.
- The client plugin establishes a regular MySQL protocol connection to the donor, then sends
COM_CLONE
MySQL protocol command to switch to the clone protocol. - The client plugin calls
clone_apply_begin(HA_CLONE_MODE_VERSION)
. The storage engine creates a locator that does not point to any snapshot but contains version negotiation information instead. - The client plugin sends
COM_INIT
to the donor with the locator payload. - The donor plugin calls
clone_begin(HA_CLONE_MODE_START)
. It checks the version information in the passed version locator. Then it creates a snapshot and prepares an actual clone locator. All subsequent flow uses this locator. - The donor plugin sends
COM_RES_LOCS
with the locators as the response to the previousCOM_INIT
. - The client plugin calls
clone_apply_begin(HA_CLONE_MODE_START)
.
- The client plugin sends
COM_EXECUTE
to the donor which asks to stream the data. - The donor plugin calls
clone_copy
(same as the local clone), whose output is then serialized into two responses:-
COM_RES_DATA_DESC
for metadata -
COM_RES_DATA
for the data itself
-
- The client plugin passes the two response payload to
clone_apply
, which is then handled the same as for the local clone, with the additional requirement that any application of the memory data is acknowledge by sendingCOM_ACK
to the donor.
- After donor completes sending all the data, the sends a
COM_RES_COMPLETE
packet. - The client plugin calls
clone_apply_end
. - The client plugin sends
COM_EXIT
to the donor. - The donor calls
clone_end
.