This method of monitoring a cloning operation can be used on the donor or recipient MySQL server instance. 

In order of occurrence, cloning operation stage events include: 

• stage/innodb/clone (file copy) : Indicates progress of the file copy phase of the cloning operation. WORK_ESTIMATED  and WORK_COMPLETED  units are file chunks. The number of files to be transferred is known at the start of the file copy phase, and the number of chunks is estimated based on the number of files. WORK_ESTIMATED  is set to the number of estimated file chunks. WORK_COMPLETED is updated after each chunk is sent. 

• stage/innodb/clone (page copy) : Indicates progress of the page copy phase of cloning operation. WORK_ESTIMATED  and WORK_COMPLETED  units are pages. Once the file copy phase is completed, the number of pages to be transferred is known, and WORK_ESTIMATED  is set to this value. WORK_COMPLETED  is updated after each page is sent. 

• stage/innodb/clone (redo copy) : Indicates progress of the redo copy phase of cloning operation. WORK_ESTIMATED  and WORK_COMPLETED  units are redo chunks. Once the page copy phase is completed, the number of redo chunks to be transferred is known, and WORK_ESTIMATED  is set to this value. WORK_COMPLETED  is updated after each chunk is sent. 

The following example demonstrates how to enable stage/innodb/clone%  event instruments and related consumer tables to monitor a cloning operation. For information about Performance Schema stage event instruments and related consumers, see Section 27.12.5, “Performance Schema Stage Event Tables” . 

1. Enable the stage/innodb/clone%  instruments: 

mysql> UPDATE performance_schema.setup_instruments SET ENABLED = ’YES’ WHERE NAME LIKE ’stage/innodb/clone%’; 

2. Enable the stage event consumer tables, which include events_stages_current , events_stages_history , and events_stages_history_long . 

mysql> UPDATE performance_schema.setup_consumers SET ENABLED = ’YES’ WHERE NAME LIKE ’%stages%’; 

3. Run a cloning operation. In this example, a local data directory is cloned to a directory named cloned_dir . 

mysql> CLONE LOCAL DATA DIRECTORY = ’/path/to/cloned_dir’; 

4. Check the progress of the cloning operation by querying the Performance Schema events_stages_current  table. The stage event shown differs depending on the cloning phase that is in progress. The WORK_COMPLETED  column shows the work completed. The WORK_ESTIMATED column shows the work required in total. 

mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE ’stage/innodb/clone%’; +--------------------------------+----------------+----------------+ | EVENT_NAME | WORK_COMPLETED | WORK_ESTIMATED | +--------------------------------+----------------+----------------+ | stage/innodb/clone (redo copy) | 1 | 1 | +--------------------------------+----------------+----------------+ 

The events_stages_current  table returns an empty set if the cloning operation has finished. In this case, you can check the events_stages_history  table to view event data for the completed operation. For example: 

mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_history 

