MySQL master-slave synchronization delay troubleshooting Slave_SQL_Running_State: Waiting for dependent transaction to commit

1. Waiting for dependent transaction to commit
1.1. Troubleshooting steps:
1. Check the error log:
    ○ Execute from the node:
        SHOW VARIABLES LIKE 'log_error';
2. Check the replication status:
    ○ Execute from the node:
        SHOW SLAVE STATUS;
3. Confirm the parallel replication settings:
    ○ From the node Execution:
        SHOW VARIABLES LIKE 'slave_parallel_workers';
4. Check long transaction:
    ○ Slave node Execute on:
        SELECT * 
        FROM information_schema.innodb_trx 
        WHERE TIME_TO_SEC(timediff(now(),trx_started)) > 60; 
5. Check the binlog of the master node:
    ○ Execute from the slave node:
        SHOW MASTER STATUS; Error log:

1.2. Output results of the analysis step:

○ Look for error messages or warnings related to sync issues.

Copy status:
○ SHOW SLAVE STATUS

  1. Slave_IO_Running and Slave_SQL_Running: Make sure both are "Yes", indicating that replication is running normally.
  2. Slave_SQL_Running_State: Displays "Waiting for dependent transaction to commit", indicating that there is currently a transaction waiting for the submission of a dependent transaction.
  3. Last_SQL_Error: View error information.

Parallel replication settings:

○ Make sure the slave_parallel_workers value is appropriate. If the value is too high, it may cause resource contention, while if the value is too low, it may cause performance degradation.

Long transaction:

○ Querying long-running transactions may affect the normal progress of replication.

Binlog of master node:

○ Ensure that the binlog file of the master node has not been cleaned. The slave node needs to obtain all binlogs to maintain synchronization.
 

Guess you like

Origin blog.csdn.net/eagle89/article/details/134952046