MySQL5.6 Replication Technology (3)-mysql master-slave replication Thread state transition

Source: Internet
Author: User

One, main library thread status (state) value

The following list shows the most common states (show processlist) that may be seen in the State column of the Binlog dump thread of the primary server in master-slave replication. If the Binlog dump thread is not visible on the primary server, this means that replication is not running, that is, no slave hosts are currently connected.

    • Sending Binlog event to Slave

Binary logs consist of various events, and an event is usually an update with some additional information. The thread has read an event from the binary log and is sending it to the slave server.

    • Finished reading one binlog; Switching to next Binlog

The thread has finished reading the binary log file and is opening the next log file to be sent to the slave server.

    • Have sent all binlog to slave; Waiting for Binlog to be updated

The thread has read all the major updates from the binary log and has been sent to the slave server. The thread is now idle, waiting for new events to appear in the binary log caused by new updates on the primary server.

    • Waiting to finalize termination

A very simple state that occurs when a thread stops.

Second, from the library I/O thread status (state) value

    • Connecting to Master

Line is impersonating attempts to connect to the primary server.

    • Checking Master Version

A status that occurs immediately after a connection with the primary server is established.

    • Registering slave on Master

A status that occurs immediately after a connection with the primary server is established.

    • Requesting Binlog Dump

A status that occurs immediately after a connection with the primary server is established. The thread sends a request to the primary server to request the contents of the binary log starting from the requested binary log file name and location.

    • Waiting to reconnect after a failed Binlog dump request

If the binary log dump request fails (because there is no connection), the thread goes to sleep and then periodically tries to reconnect. You can use the –master-connect-retry option to specify the interval between retries.

    • Reconnecting after a failed Binlog dump request

The thread is trying to reconnect to the primary server.

    • Waiting for master to send event

The thread is already connected to the primary server and is waiting for the binary log event to arrive. If the primary server is idle, it will last for a long time. If the wait lasts slave_read_timeout seconds, a timeout occurs. At this point, the thread considers the connection to be interrupted and attempts to reconnect.

    • Queueing master event to the relay log

The thread has read an event and is copying it to the trunk log for processing by the SQL thread.

    • Waiting to reconnect after a failed master event read

An error occurs while reading (because there is no connection) and the thread will sleep master-connect-retry seconds before attempting to reconnect.

    • Reconnecting after a failed master event read

The thread is trying to reconnect to the primary server, and when the connection is re-established, the state becomes waiting for the master to send event.

    • Waiting for the slave SQL thread to free enough relay log space

A non-0 Relay_log_space_limit value is being used, and the trunk log has grown to its combined size beyond that value. The I/O thread is waiting until the SQL thread processes the trunk log content and removes some of the trunk log files to free up enough space.

    • Waiting for slave mutexes on exit

A very simple state that occurs when a thread stops.

Iii. from the Library SQL thread status (state) value

    • Reading event from the relay log

The thread has read an event from the trunk log and can handle the event.

    • Have read all relay log; Waiting for the slave I/O thread to update it

The thread has processed all the events in the trunk log file and is now waiting for the I/O thread to write the new event to the relay log.

    • Waiting for slave mutexes on exit

A very simple state that occurs when a thread stops.

Iv. Connecting Thread status (state) values from the library

These thread states occur in replication from the library, but are associated with the connector threads, not the I/O or SQL line threads.

    • changing Master

The line is impersonating is processing the change MASTER to statement.

    • Killing slave

The line is impersonating is processing the stop slave statement.

    • Opening Master Dump Table

This state occurs after the creating table from master dump.

    • Reading Master Dump table data

This state occurs after the opening Master dump table.

    • Rebuilding the index on Master dump table

This state occurs after reading Master dump table data.

MySQL5.6 Replication Technology (3)-mysql master-slave replication Thread state transition

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.