content_image/813467.jpg
START {REPLICA | SLAVE} UNTIL SQL_AFTER_MTS_GAPS; SET @@GLOBAL.slave_parallel_workers = 0; START {REPLICA | SLAVE} SQL_THREAD; 

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

## Note 

It is possible to view the entire text of a running START REPLICA | SLAVE statement, including any USER  or PASSWORD  values used, in the output of SHOW PROCESSLIST . This is also true for the text of a running CHANGE REPLICATION SOURCE TO  | CHANGE MASTER TO  statement, including any values it employs for SOURCE_USER  | MASTER_USER  or SOURCE_PASSWORD  | MASTER_PASSWORD . 

START REPLICA | SLAVE  sends an acknowledgment to the user after both the replication I/O thread and the replication SQL thread have started. However, the replication I/O thread may not yet have connected. For this reason, a successful START REPLICA | SLAVE  causes SHOW REPLICA | SLAVE STATUS to show Replica_SQL_Running=Yes , but this does not guarantee that Replica_IO_Running=Yes (because Replica_IO_Running=Yes  only if the I/O thread is running and connected ). For more information, see Section 13.7.7.35, “SHOW REPLICA | SLAVE STATUS Statement” , and Section 17.1.7.1, “Checking Replication Status” . 

An UNTIL  clause ( until_option , in the preceding grammar) may be added to specify that the replica should start and run until the replication SQL thread reaches a given point in the source’s binary log or in the replica’s relay log. Use one of the following pairs of options to specify the position: 

• MASTER_LOG_POS  and MASTER_LOG_FILE  for the binary log (to MySQL 8.0.22). 

• SOURCE_LOG_POS  and SOURCE_LOG_FILE  for the binary log (from MySQL 8.0.23). 

• RELAY_LOG_POS  and RELAY_LOG_FILE  for the relay log. 

For compressed transaction payloads, the position must be based on the compressed Transaction_payload_event . When the SQL thread reaches the point specified, it stops. If the SQL_THREAD  option is specified in the statement, it starts only the SQL thread. Otherwise, it starts both replication threads. If the SQL thread is running, the UNTIL  clause is ignored and a warning is issued. You cannot use an UNTIL  clause with the IO_THREAD  option. 

It is also possible with START REPLICA | SLAVE UNTIL  to specify a stop point relative to a given GTID or set of GTIDs using one of the options SQL_BEFORE_GTIDS  or SQL_AFTER_GTIDS , as explained previously in this section. When using one of these options, you can specify SQL_THREAD , IO_THREAD , both of these, or neither of them. If you specify only SQL_THREAD , then only the replication SQL thread is affected by the statement; if only IO_THREAD  is used, then only the replication I/O thread is affected. If both SQL_THREAD  and IO_THREAD  are used, or if neither of them is used, then both the SQL and I/O threads are affected by the statement. 

For an UNTIL  clause, you must specify any one of the following: 

• Both  a log file name and a position in that file 

• Either  of SQL_BEFORE_GTIDS  or SQL_AFTER_GTIDS 

• SQL_AFTER_MTS_GAPS 

Do not mix source and relay log options. Do not mix log file options with GTID options. 

The UNTIL  clause is not supported for multithreaded replicas except when also using SQL_AFTER_MTS_GAPS . If UNTIL  is used on a multithreaded replica without SQL_AFTER_MTS_GAPS , the 

