Replication Threads
Contents
MariaDB's replication implementation requires several types of threads.
Threads on the Master
The master only has one type of replication-related thread: the binary log dump thread.
Binary Log Dump Thread
The binary log dump thread runs on the master and dumps the binary log to the slave. In SHOW PROCESSLIST
output, this thread is identified by Binlog Dump
. SHOW SLAVE HOSTS
gives you a list of replication slaves currently registered with the master.
Threads on the Slave
The slave has three types of replication-related threads: the slave I/O thread, the slave SQL thread, and worker threads, which are only applicable when parallel replication is in use.
When multi-source replication is in use, each independent replication connection has its own slave threads of each type.
Slave I/O Thread
The slave's I/O thread receives the binary log events from the master and writes them to its relay log.
Slave SQL Thread
The slave's SQL thread reads events from the relay log. What it does with them depends on whether parallel replication is in use. If parallel replication is not in use, then the SQL thread applies the events to its local copy of the data. If parallel replication is in use, then the SQL thread hands off the events to its worker threads to apply in parallel.
Worker Threads
When parallel replication is in use, then the SQL thread hands off the events to its worker threads to apply in parallel.