Skip to content

Commit 089fc00

Browse files
committed
Ignore XA rollback exception. Fixes #1317
Signed-off-by: Bradley Grainger <[email protected]>
1 parent 0acea34 commit 089fc00

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/MySqlConnector/Core/XaEnlistedTransaction.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ private void ExecuteXaCommand(string statement)
4343
{
4444
using var cmd = Connection.CreateCommand();
4545
cmd.CommandText = "XA " + statement + " " + m_xid;
46-
cmd.ExecuteNonQuery();
46+
try
47+
{
48+
cmd.ExecuteNonQuery();
49+
}
50+
catch (MySqlException ex) when (ex.ErrorCode is MySqlErrorCode.XARBDeadlock)
51+
{
52+
// ignore deadlock when rolling back
53+
}
4754
}
4855

4956
private static int s_currentId;

0 commit comments

Comments
 (0)