[MDEV-13606] XA PREPARE transactions should survive innodb_force_recovery=1 or 2 Created: 2017-08-21  Updated: 2017-08-31  Resolved: 2017-08-23

Status: Closed
Project: MariaDB Server
Component/s: Backup, Storage Engine - InnoDB
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.0.33, 10.1.27, 10.2.9, 10.3.2

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: 2PC, XA, recovery

Issue Links:
Relates
relates to MDEV-13437 InnoDB fails to return error for XA C... Closed

 Description   

We should revert part of this InnoDB change in MySQL 5.0.3 (making innodb_force_recovery=1 and innodb_force_recovery=2 initiate rollback of a transaction that reached the XA PREPARE state before previous crash or shutdown) (March 2005).
It seems that the option tc_heuristic_recover=ROLLBACK in MySQL 5.0.3 (January 2005) was introduced for exactly this purpose; there was no need to convolute the logic of an already confusing InnoDB parameter.



 Comments   
Comment by Marko Mäkelä [ 2017-08-23 ]

Actually the questionable logic for rolling back XA PREPARE transactions was added already in a March 1, 2005 commit, that is, 12 days before the refactoring, which also added innodb_support_xa that was made a no-op in MySQL 5.7.10 and MariaDB 10.2.6 and removed in MariaDB 10.3.0.

Comment by Marko Mäkelä [ 2017-08-23 ]

bb-10.0-marko

Comment by Jan Lindström (Inactive) [ 2017-08-24 ]

ok to push as we have that tc_heuristic_recover.

Comment by Marko Mäkelä [ 2017-08-28 ]

Before this change, when preparing a backup, Mariabackup 10.1 would unconditionally roll back transactions that were recovered in XA PREPARE state. Starting with Mariabackup 10.1.27, such transactions will be left alone.
Mariabackup for MariaDB 10.2 (first released as version 10.2.7) does not process any undo log records or change any transaction state. (Even the --export option is not supported before MDEV-13466 implements it.)

Comment by Marko Mäkelä [ 2017-08-29 ]

As a result of this change, setting innodb_force_recovery=3 will no longer hide recovered XA PREPARE transactions from the server.
If the binlog is enabled and internally acts as a XA resource manager for cross-engine transactions, this means that also with innodb_force_recovery=3, decisions to XA COMMIT or XA ROLLBACK based on the binlog contents will continue to be made. This affects the way how MDEV-13437 can be reproduced.

Generated at Thu Feb 08 08:06:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.