[MDEV-14609] XA Transction unable to ROLLBACK TO SAVEPOINT Created: 2017-12-08  Updated: 2018-01-15  Resolved: 2018-01-15

Status: Closed
Project: MariaDB Server
Component/s: XA
Affects Version/s: 5.5, 10.0, 10.1, 10.2.10, 10.2.11, 10.2
Fix Version/s: 5.5.59, 10.0.34, 10.3.4, 10.1.31, 10.2.13

Type: Bug Priority: Major
Reporter: Olaf Buitelaar Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: Compatibility, upstream-fixed
Environment:

standard docker image


Sprint: 5.5.59

 Description   

It appears it's not possible to restore to an savepoint within in a XA transaction

create table t1(
	c1 int
) engine=innodb;
 
XA START 'xa1';
SAVEPOINT savepoint1;
INSERT INTO t1 (c1) VALUES (1),(2),(3),(4);
 
ROLLBACK TO SAVEPOINT savepoint1;

this gives error:
Error Code: 1399. XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state

When i try the exact same query in mysql (5.7), this produces no errors, also the transaction is restored to the actual savepoint.
When savepoints wouldn't be supported in XA transactions, i would expect the SAVEPOINT x would already result in an error.



 Comments   
Comment by Elena Stepanova [ 2017-12-10 ]

It's also reproducible on MySQL 5.5, but apparently the behavior has changed since 5.6.

Comment by Alexander Barkov [ 2018-01-15 ]

See also "git show 1a7e7a0f756d34a94d35c8cbf03823fb68d10044" in MySQL code base:

This patch fixes the bug#13737343 (formerly known as 64374): XA TRANSACTIONS AND SAVEPOINT.

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