I have been trying to solve some MySQL deadlock issues using show engine innodb status.
Our platform uses Google's Cloud SQL and the offending SQL queries in the Innodb Monitor is truncating the queries to only 903 characters. Circa 2016 there was a bug that truncated the report to 1024 characters, but this was resolved https://bugs.mysql.com/bug.php?id=80927. I am using Hibernate ORM so the queries can be quite long.
Any thoughts as to how I can fix this or obtain the query data another way?
Some data from the excerpts have been omitted as to not publish protected data (passwords, etc).
Query Excerpts from the Innodb Monitor
1st Transaction Query: 903 characters
update AppUser set Address1='919 Conference Drive #4285', AgentPortalAccessToken=null, AgentPortalAccessTokenExpires=null, AgentPortalActive=0, AgentPortalKeySecret=null, AgentPortalLastLoginDateTime=null, AppUserType='NORMAL', AutoDialerPhone=null, BrokerName='', BrokerNum='Dotted & Crossed', City='Goodlettsville', Email1='[.. OMIT ...]', Fax='', FirstName='Paige', ICalFeedAccessKey='[.. OMIT ...]', IsActive=1, LastLoginDateTime='2023-10-20 13:39:49', LastName='Collier', LicenseNum='', LogoFileName='6664cfd4-c435-4c80-b29a-e63853f1fb84.png', Mobile='[.. OMIT ...]', PasswordChangeRequired=0, PasswordHash='[.. OMIT ...]', PasswordResetKey=null, PasswordResetKeyExpires=null, PayableTo='Dotted & Crossed', Phone1='[.. OMIT ...]', ProfileFileName='7dadd45c-9b41-46e9-a944-e740b0c1043e.jpg', RelationshipLeadTime_
2nd Transaction Query: 903 characters
update AppUser set Address1='1500 Medical Center Parkway suite 2e', AgentPortalAccessToken='946131', AgentPortalAccessTokenExpires='2023-08-04 15:03:45', AgentPortalActive=1, AgentPortalKeySecret='[.. OMIT ...]', AgentPortalLastLoginDateTime=null, AppUserType='NO_LOGIN', AutoDialerPhone=null, BrokerName='Zach Taylor', BrokerNum='265048', City='Murfreesboro', Email1='[.. OMIT ...]', Fax='', FirstName='Hannah', ICalFeedAccessKey='[.. OMIT ...]', IsActive=1, LastLoginDateTime='2023-08-04 14:53:57', LastName='Mazzaferro', LicenseNum='354478', LogoFileName='b6f94afa-16d8-4e03-a555-38c2ee7df042.png', Mobile='[.. OMIT ...]', PasswordChangeRequired=0, PasswordHash='[.. OMIT ...]', PasswordResetKey=null, PasswordResetKeyExpires=null, PayableTo='Zach Taylor', Phone1='[.. OMIT ...]', ProfileFileName=
Full Innodb Monitor Output
=====================================
2023-10-20 14:31:06 139972890150656 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 16 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1088588 srv_active, 0 srv_shutdown, 838739 srv_idle
srv_master_thread log flush and writes: 0
------------------------
LATEST DETECTED DEADLOCK
------------------------
2023-10-20 13:57:20 139973168084736
*** (1) TRANSACTION:
TRANSACTION 44664777, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 11 lock struct(s), heap size 1128, 5 row lock(s), undo log entries 2
MySQL thread id 1025545, OS thread handle 139972910249728, query id 100492071 cloudsqlproxy~34.125.160.253 root updating
update AppUser set Address1='919 Conference Drive #4285', AgentPortalAccessToken=null, AgentPortalAccessTokenExpires=null, AgentPortalActive=0, AgentPortalKeySecret=null, AgentPortalLastLoginDateTime=null, AppUserType='NORMAL', AutoDialerPhone=null, BrokerName='', BrokerNum='Dotted & Crossed', City='Goodlettsville', Email1='[.. OMIT ...]', Fax='', FirstName='Paige', ICalFeedAccessKey='[.. OMIT ...]', IsActive=1, LastLoginDateTime='2023-10-20 13:39:49', LastName='Collier', LicenseNum='', LogoFileName='6664cfd4-c435-4c80-b29a-e63853f1fb84.png', Mobile='[.. OMIT ...]', PasswordChangeRequired=0, PasswordHash='[.. OMIT ...]', PasswordResetKey=null, PasswordResetKeyExpires=null, PayableTo='Dotted & Crossed', Phone1='[.. OMIT ...]', ProfileFileName='7dadd45c-9b41-46e9-a944-e740b0c1043e.jpg', RelationshipLeadTime_
*** (1) HOLDS THE LOCK(S):
RECORD LOCKS space id 142 page no 1404 n bits 80 index PRIMARY of table `afdata`.`AppUser` trx id 44664777 lock mode S locks rec but not gap
Record lock, heap no 4 PHYSICAL RECORD: n_fields 47; compact format; info bits 0
[.. OMIT ...]
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 142 page no 1262 n bits 80 index PRIMARY of table `afdata`.`AppUser` trx id 44664777 lock_mode X locks rec but not gap waiting
Record lock, heap no 8 PHYSICAL RECORD: n_fields 47; compact format; info bits 0
[.. OMIT ...]
*** (2) TRANSACTION:
TRANSACTION 44664776, ACTIVE 0 sec starting index read
mysql tables in use 1, locked 1
LOCK WAIT 70 lock struct(s), heap size 8312, 117 row lock(s), undo log entries 3
MySQL thread id 1025568, OS thread handle 139972994504448, query id 100492103 cloudsqlproxy~34.125.160.253 root updating
update AppUser set Address1='1500 Medical Center Parkway suite 2e', AgentPortalAccessToken='946131', AgentPortalAccessTokenExpires='2023-08-04 15:03:45', AgentPortalActive=1, AgentPortalKeySecret='[.. OMIT ...]', AgentPortalLastLoginDateTime=null, AppUserType='NO_LOGIN', AutoDialerPhone=null, BrokerName='Zach Taylor', BrokerNum='265048', City='Murfreesboro', Email1='[.. OMIT ...]', Fax='', FirstName='Hannah', ICalFeedAccessKey='[.. OMIT ...]', IsActive=1, LastLoginDateTime='2023-08-04 14:53:57', LastName='Mazzaferro', LicenseNum='354478', LogoFileName='b6f94afa-16d8-4e03-a555-38c2ee7df042.png', Mobile='[.. OMIT ...]', PasswordChangeRequired=0, PasswordHash='[.. OMIT ...]', PasswordResetKey=null, PasswordResetKeyExpires=null, PayableTo='Zach Taylor', Phone1='[.. OMIT ...]', ProfileFileName=
[.. OMIT ...]
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 142 page no 1262 n bits 80 index PRIMARY of table `afdata`.`AppUser` trx id 44664776 lock_mode X locks rec but not gap
Record lock, heap no 2 PHYSICAL RECORD: n_fields 47; compact format; info bits 0
[.. OMIT ...]
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 142 page no 1404 n bits 80 index PRIMARY of table `afdata`.`AppUser` trx id 44664776 lock_mode X locks rec but not gap waiting
Record lock, heap no 4 PHYSICAL RECORD: n_fields 47; compact format; info bits 0
0: len 8; hex 8000000000002587; asc % ;;[.. OMIT ...]
*** WE ROLL BACK TRANSACTION (1)
[.. OMIT ...]
----------------------------
END OF INNODB MONITOR OUTPUT
============================
SHOW FULL PROCESSLISTcan help here. Not sure there's aFULLequivalent for theSHOW STATUS.SELECT VERSION();what does it say? Does the version you use include the bug fix from #80927?1071386 root cloudsqlproxy~34.125.129.11 afdata Sleep 1781