[MDEV-32813] read-only xa prepare may disappear upon server restart Created: 2023-11-15  Updated: 2023-11-15

Status: Open
Project: MariaDB Server
Component/s: Replication, Server
Affects Version/s: 10.6
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Andrei Elkin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-742 LP:803649 - Xa recovery failed on cli... Closed

 Description   

A prepared user xa that does not modify any engine data may get binlogged. E.g
from binlog_empty_xa_prepared.test:

XA START '3';
CREATE TEMPORARY TABLE tmp_1(c INT);
XA END '3';
XA PREPARE '3';

ends in binlog with

| master-bin.000001 | 555 | Gtid              |         1 |         600 | XA START X'33',X'',1 GTID 0-1-2                                |
| master-bin.000001 | 600 | Query             |         1 |         685 | XA END X'33',X'',1                                             |
| master-bin.000001 | 685 | XA_prepare        |         1 |         722 | XA PREPARE X'33',X'',1  

and stays recovered

 > xa recover;
+----------+--------------+--------------+------+
| formatID | gtrid_length | bqual_length | data |
+----------+--------------+--------------+------+
|        1 |            1 |            0 | 3    |
+----------+--------------+--------------+------+

while the server is alive.

It's gone after the server restart.
shutdown;
Query OK, 0 rows affected (0.00 sec)
 
18:16:32 [test]> xa recover;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    4
Current database: test
 
Empty set (0.03 sec)

An obvious resolution is to prevent logging the empty XA-prepare group.


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