# Replication lag issue between two PXC clusters with status message "Waiting for dependent transaction to commit" on replica

**URL:** <https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235>\
**Category:** Percona Operator for MySQL\
**Created:** [April 6, 2023, 7:36pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235 "2023-04-06T19:36:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmcdonald](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@tmcdonald](https://forums.percona.com/u/tmcdonald)\
**Post date:** [April 6, 2023, 7:36pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235/1 "2023-04-06T19:36:53Z")

</div>

We have a client who is running three, three node PXC clusters (nine total nodes) in OpenShift using operator version 8.0.29-21.1. In this configuration, the primary cluster is replicating to the other two clusters simultaneously. Similar to the following diagram below.

 ![pxc diagram](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/8/8910c6a20e5c35e8ec05381710c6190f8ff33df2.png)

An alert was received this morning that replication was lagging behind the primary on one of the replicas. I went to the replica in question and executed the show replica status command and noted the Replica\_SQL\_Running\_State has a value of “Waiting for dependent transaction to commit” (see below).

mysql\> show replica status\G  
\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
Replica\_IO\_State: Waiting for source to send event  
Source\_Host: [a6bd61dd0a27847d58378a12ad3f02f5-6e281c2d79690133.elb.us-west-2.amazonaws.com](http://a6bd61dd0a27847d58378a12ad3f02f5-6e281c2d79690133.elb.us-west-2.amazonaws.com)  
Source\_User: replication  
Source\_Port: 3306  
Connect\_Retry: 60  
Source\_Log\_File: binlog.003030  
Read\_Source\_Log\_Pos: 13597329  
Relay\_Log\_File: wordpress-db-pxc-0-relay-bin-awspxc1\_to\_vmwarepxc1.000016  
Relay\_Log\_Pos: 7350063  
Relay\_Source\_Log\_File: binlog.003030  
Replica\_IO\_Running: Yes  
Replica\_SQL\_Running: Yes  
Replicate\_Do\_DB:  
Replicate\_Ignore\_DB:  
Replicate\_Do\_Table:  
Replicate\_Ignore\_Table:  
Replicate\_Wild\_Do\_Table:  
Replicate\_Wild\_Ignore\_Table:  
Last\_Errno: 0  
Last\_Error:  
Skip\_Counter: 0  
Exec\_Source\_Log\_Pos: 7349853  
Relay\_Log\_Space: 13597868  
Until\_Condition: None  
Until\_Log\_File:  
Until\_Log\_Pos: 0  
Source\_SSL\_Allowed: No  
Source\_SSL\_CA\_File:  
Source\_SSL\_CA\_Path:  
Source\_SSL\_Cert:  
Source\_SSL\_Cipher:  
Source\_SSL\_Key:  
Seconds\_Behind\_Source: 20965  
Source\_SSL\_Verify\_Server\_Cert: Yes  
Last\_IO\_Errno: 0  
Last\_IO\_Error:  
Last\_SQL\_Errno: 0  
Last\_SQL\_Error:  
Replicate\_Ignore\_Server\_Ids:  
Source\_Server\_Id: 41819022  
Source\_UUID: cd443a8a-b942-11ed-8612-0a580a210614  
Source\_Info\_File: mysql.slave\_master\_info  
SQL\_Delay: 0  
SQL\_Remaining\_Delay: NULL  
Replica\_SQL\_Running\_State: Waiting for dependent transaction to commit  
Source\_Retry\_Count: 5  
Source\_Bind:  
Last\_IO\_Error\_Timestamp:  
Last\_SQL\_Error\_Timestamp:  
Source\_SSL\_Crl:  
Source\_SSL\_Crlpath:  
Retrieved\_Gtid\_Set: 6235c032-b942-11ed-863e-865d3b297558:1870258-1907832  
Executed\_Gtid\_Set: 148dd969-d3c3-11ed-815e-0a580a80026b:1-12,  
16f0a566-d3c3-11ed-9642-ee92fdae9413:1-842,  
6235c032-b942-11ed-863e-865d3b297558:1-1898094  
Auto\_Position: 1  
Replicate\_Rewrite\_DB:  
Channel\_Name: awspxc1\_to\_vmwarepxc1  
Source\_TLS\_Version:  
Source\_public\_key\_path:  
Get\_Source\_public\_key: 0  
Network\_Namespace:

All nodes in all clusters are using the same configuration.

I checked the replica on the other cluster and it’s not having any replication lag issues. I then checked the replica\_parallel\_type and replica\_parallel\_workers variables and noted the parallel workers variable is set to the default value of 4.

This replica has been like this for a while now and it’s behaving like it’s in a deadlock situation. Therefore, I’m trying to determine how to fix this without losing any data.

---

<div class="post-metadata">

**Author:** ![tmcdonald](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@tmcdonald](https://forums.percona.com/u/tmcdonald)\
**Post date:** [April 10, 2023, 3:32pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235/2 "2023-04-10T15:32:43Z")

</div>

Does anybody have any recommendations for resolving this issue?

Thanks!

---

<div class="post-metadata">

**Author:** ![yunus\_shaikh](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/yunus_shaikh/32/3512_2.png) [@yunus\_shaikh](https://forums.percona.com/u/yunus_shaikh)\
**Post date:** [April 12, 2023, 12:45pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235/3 "2023-04-12T12:45:45Z")

</div>

> [@tmcdonald](#):
>
> Waiting for dependent transaction to commit

What happens when you restart the replication thread?

```auto
stop replica;start replica;

```

Is the thread still in a deadlock situation, or do you see Exec\_Source\_Log\_Pos moving?  
Trying to understand that it is continuously in deadlock situation or intermittently and keep resolving.

---

<div class="post-metadata">

**Author:** ![tmcdonald](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@tmcdonald](https://forums.percona.com/u/tmcdonald)\
**Post date:** [April 12, 2023, 1:07pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235/4 "2023-04-12T13:07:22Z")

</div>

On the original replica, for which I created this posting, nothing happened when we stopped the replica, it just hangs. We ended up rebuilding the replica.

Yesterday, I noticed the other replica is doing the same thing and has been in this state for at least a day. The exec\_source\_log\_pos is not moving. The Retrieved\_Gtid\_Set keeps incrementing, but the Executed\_Gtid\_Set hasn’t changed. The Replica\_SQL\_Running\_State remains “Waiting for dependent transaction to commit”

---

<div class="post-metadata">

**Author:** ![yves.trudeau](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/yves.trudeau/32/2825_2.png) [@yves.trudeau](https://forums.percona.com/u/yves.trudeau)\
**Post date:** [April 12, 2023, 2:33pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235/5 "2023-04-12T14:33:55Z")

</div>

Hi,  
The “Waiting for dependent transaction to commit” is caused by transaction waiting for other transaction in the group commit to complete before they can commit. This is caused by “replica\_preserve\_commit\_order = on”. Transactions within a group commit are independent and could, at least in theory, commit in a different order. With PXC, since each transaction must be acknowledge by all cluster nodes, removing that constraint may help.

---

<div class="post-metadata">

**Author:** ![tmcdonald](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@tmcdonald](https://forums.percona.com/u/tmcdonald)\
**Post date:** [April 13, 2023, 7:20pm UTC](https://forums.percona.com/t/replication-lag-issue-between-two-pxc-clusters-with-status-message-waiting-for-dependent-transaction-to-commit-on-replica/21235/6 "2023-04-13T19:20:01Z")

</div>

Yes, setting “replica\_preserve\_commit\_order = off” took care of the issue.

Thanks!
