[MDEV-32549] Cluster is inconsistent after SAVEPOINT statement is rolled back Created: 2023-10-23  Updated: 2023-12-22  Resolved: 2023-12-22

Status: Closed
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.5
Fix Version/s: 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3

Type: Bug Priority: Critical
Reporter: Daniele Sciascia Assignee: Julius Goryavsky
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 Description   

The following test show how to make a cluster inconsistent with a transaction that uses a savepoint with both innodb and aria storage engines involved:

connection node_1;
CREATE TABLE t1 (a INTEGER PRIMARY KEY) engine=innodb;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
SELECT count(*) a from mysql.db;
a
2
SAVEPOINT s1;
ERROR 42000: The storage engine for the table doesn't support SAVEPOINT
INSERT INTO t1 VALUES (2);
COMMIT;
connection node_1;
SELECT * FROM t1;
a
1
2
connection node_2;
SELECT * FROM t1;
a
2

Aria does not support SAVEPOINT, so an error is returned and the statement is rolled back.
This statement rollback is incorrectly causes the trx cache to be truncated back to the beginning of the transaction. Ultimately causing an inconsistency, as only the second half of the transaction is replicated to the rest of the cluster.



 Comments   
Comment by Daniele Sciascia [ 2023-11-29 ]

A pull request has been submitted, and is ready for review.

Comment by Julius Goryavsky [ 2023-12-22 ]

Thanks, fix merged with head revision: https://github.com/MariaDB/server/commit/362c0950e8999a88f5866fc7361e10615364e4a3

Comment by Julius Goryavsky [ 2023-12-22 ]

Fix merged with head revision: https://github.com/MariaDB/server/commit/362c0950e8999a88f5866fc7361e10615364e4a3

Generated at Thu Feb 08 10:32:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.