# Deadlock found when trying to get lock; try restarting transaction?

**URL:** <https://forums.percona.com/t/deadlock-found-when-trying-to-get-lock-try-restarting-transaction/8389>\
**Category:** Percona XtraDB Cluster 8.x\
**Created:** [December 15, 2020, 2:55am UTC](https://forums.percona.com/t/deadlock-found-when-trying-to-get-lock-try-restarting-transaction/8389 "2020-12-15T02:55:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lokesh123](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lokesh123/32/5519_2.png) [@lokesh123](https://forums.percona.com/u/lokesh123)\
**Post date:** [December 15, 2020, 2:55am UTC](https://forums.percona.com/t/deadlock-found-when-trying-to-get-lock-try-restarting-transaction/8389/1 "2020-12-15T02:55:44Z")

</div>

2020-12-15T03:03:15.997431-05:00 11 [Note] [MY-000000] [WSREP] --------- CONFLICT DETECTED --------

2020-12-15T03:03:15.997438-05:00 11 [Note] [MY-000000] [WSREP] cluster conflict due to high priority abort for threads:

2020-12-15T03:03:15.997443-05:00 11 [Note] [MY-000000] [WSREP] Winning thread:

THD: 11, mode: high priority, state: exec, conflict: executing, seqno: 390433

SQL: (null)

2020-12-15T03:03:15.997448-05:00 11 [Note] [MY-000000] [WSREP] Victim thread:

THD: 83852, mode: local, state: exec, conflict: executing, seqno: -1

SQL:

INSERT INTO `tb`.`alt_n_nt`(PaymentFileID,PaymentID,`ClientID`,`EventID`,`AlertTypeID`,`NotificationTypeID`,`IsGenerated`,`CreatedAt`,`TemplateID`,`FileName`,`ErrorDetails`)VALUES (_PaymentFileID,p\_PaymentID,p\_ClientID,13,1,4,0,now(),5,CONCAT('Remittance File: ‘,p\_ClientID,’_‘,p\_PaymentID),CONCAT(‘Remittance Creation Failed -’,’ ClientID: ‘,p\_ClientID,’ PaymentID: ',p\_PaymentID))TRANSACTION 1030660, ACTIVE 0 sec inserting

mysql tables in use 1, locked 1

MySQL thread id 13, OS thread handle 140115793000192, query id 14035220 wsrep: writing row for write-set (390541)TRANSACTION 1030659, ACTIVE 0 sec inserting

mysql tables in use 1, locked 1

, undo log entries 1

MySQL thread id 83852, OS thread handle 140115122792192, query id 14035219 [prod-db-01.ibtechciti.com](http://prod-db-01.ibtechciti.com) 172.31.0.216 root update

INSERT INTO `tb`.`alt_n_nt` (PaymentFileID,PaymentID,`ClientID`,`EventID`,`AlertTypeID`,`NotificationTypeID`,`IsGenerated`,`CreatedAt`,`TemplateID`,`FileName`,`ErrorDetails`)VALUES(_PaymentFileID,p\_PaymentID,p\_ClientID,13,1,4,0,now(),5,CONCAT('Remittance File: ‘,p\_ClientID,’_‘,p\_PaymentID),CONCAT(‘Remittance Creation Failed -’,’ ClientID: ‘,p\_ClientID,’ PaymentID: ',p\_PaymentID))

---

<div class="post-metadata">

**Author:** ![CTutte](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ctutte/32/1341_2.png) [@CTutte](https://forums.percona.com/u/CTutte)\
**Post date:** [December 18, 2020, 8:10am UTC](https://forums.percona.com/t/deadlock-found-when-trying-to-get-lock-try-restarting-transaction/8389/2 "2020-12-18T08:10:24Z")

</div>

Hi lokesh123,

2020-12-15T03:03:15.997431-05:00 11 [Note] [MY-000000] [WSREP] --------- CONFLICT DETECTED --------

2020-12-15T03:03:15.997438-05:00 11 [Note] [MY-000000] [WSREP] cluster conflict due to high priority abort for threads:

2020-12-15T03:03:15.997443-05:00 11 [Note] [MY-000000] [WSREP] Winning thread:

THD: 11, mode: high priority, state: exec, conflict: executing, seqno: 390433

Top 2 reasons for conflicts in PXC/Galera are:

1. You are executing a DDL which conflicts with some other DML that will be aborted. Please refer to this blogpost [https://www.percona.com/blog/2019/03/25/how-to-perform-compatible-schema-changes-in-percona-xtradb-cluster-advanced-alternative/](https://www.percona.com/blog/2019/03/25/how-to-perform-compatible-schema-changes-in-percona-xtradb-cluster-advanced-alternative/)

2. You are doing multi mater writes. Even if PXC allows for multi master writes, due to the nature of certification process, if there is a race condition in which one DML was already certified by the majority of the nodes, another DML which conflict with the already certified DML will be aborted and rolled back. Please do check this other blogpost [https://www.percona.com/blog/2012/11/20/understanding-multi-node-writing-conflict-metrics-in-percona-xtradb-cluster-and-galera/](https://www.percona.com/blog/2012/11/20/understanding-multi-node-writing-conflict-metrics-in-percona-xtradb-cluster-and-galera/) , and check for wsrep\_local\_commits to identify if there are local commits on the node, and for wsrep\_local\_cert\_failures and wsrep\_local\_bf\_aborts for replication aborts.

Regards
