diff --git a/src/MySqlConnector/Core/XaEnlistedTransaction.cs b/src/MySqlConnector/Core/XaEnlistedTransaction.cs index 9f1ffe73c..496f8c566 100644 --- a/src/MySqlConnector/Core/XaEnlistedTransaction.cs +++ b/src/MySqlConnector/Core/XaEnlistedTransaction.cs @@ -32,8 +32,15 @@ protected override void OnRollback(Enlistment enlistment) { try { - if (!IsPrepared) - ExecuteXaCommand("END"); + try + { + if (!IsPrepared) + ExecuteXaCommand("END"); + } + catch (MySqlException ex) when (ex.ErrorCode is MySqlErrorCode.XAERRemoveFail && ex.Message.Contains("ROLLBACK ONLY")) + { + // ignore unprepared end failure when XAERRemoveFail is returned telling us the XA state is ROLLBACK ONLY. + } ExecuteXaCommand("ROLLBACK"); }