content_image/735839.jpg content_image/735840.jpg
•The replica’s connection metadata repository  contains information that the replication I/O thread needs to connect to the replication source server and retrieve transactions from the source’s binary log. The metadata in this repository includes the connection configuration, the replication user account details, the SSL settings for the connection, and the file name and position where the replication I/O thread is currently reading from the source’s binary log. 

•The replica’s applier metadata repository  contains information that the replication SQL thread needs to read and apply transactions from the replica’s relay log. The metadata in this repository includes the file name and position up to which the replication SQL thread has executed the transactions in the relay log, and the equivalent position in the source’s binary log. It also includes metadata for the process of applying transactions, such as the number of worker threads and the PRIVILEGE_CHECKS_USER account for the channel. 

The connection metadata repository is written to the slave_master_info  table in the mysql  system schema, and the applier metadata repository is written to the slave_relay_log_info  table in the mysql  system schema. A warning message is issued if mysqld  is unable to initialize the tables for the replication metadata repositories, but the replica is allowed to continue starting. This situation is most likely to occur when upgrading from a version of MySQL that does not support the use of tables for the repositories to one in which they are supported. 

<img src='content_image/735839.jpg'>

<img src='content_image/735840.jpg'>

## Important 

1. Do not attempt to update or insert rows in the mysql.slave_master_info or mysql.slave_relay_log_info  tables manually. Doing so can cause undefined behavior, and is not supported. Execution of any statement requiring a write lock on either or both of the slave_master_info  and slave_relay_log_info  tables is disallowed while replication is ongoing (although statements that perform only reads are permitted at any time). 

2. Access privileges for the connection metadata repository table mysql.slave_master_info  should be restricted to the database administrator, because it contains the replication user account name and password for connecting to the source. Use a restricted access mode to protect database backups that include this table. From MySQL 8.0.21, you can clear the replication user account credentials from the connection metadata repository, and instead always provide them using the START REPLICA | SLAVE  statement or START GROUP_REPLICATION  statement that starts the replication channel. This approach means that the replication channel always needs operator intervention to restart, but the account name and password are not recorded in the replication metadata repositories. 

RESET REPLICA | SLAVE  clears the data in the replication metadata repositories, with the exception of the replication connection parameters (depending on the MySQL Server release). For details, see the description for RESET REPLICA | SLAVE . 

Before MySQL 8.0, to create the replication metadata repositories as tables, it was necessary to specify master_info_repository=TABLE  and relay_log_info_repository=TABLE  at server startup. Otherwise, the repositories were created as files in the data directory named master.info  and relay- log.info , or with alternative names and locations specified by the --master-info-file  option and relay_log_info_file  system variable. From MySQL 8.0, creating the replication metadata repositories as tables is the default, and the use of all these system variables is deprecated. 

The mysql.slave_master_info  and mysql.slave_relay_log_info  tables are created using the InnoDB  transactional storage engine. Updates to the applier metadata repository table are committed together with the transactions, meaning that the replica’s progress information recorded in that repository is always consistent with what has been applied to the database, even in the event of an unexpected server 

