mariadb/mysql-test/suite/binlog_in_engine/spider.test
Kristian Nielsen 52a4a852bb Binlog-in-engine: Initial support for 2pc and XA
At XA PREPARE, spill all events (including COMMIT end event) as OOB, and
call into the engine to binlog a PREPARE record. Store the OOB reference
along with the XID in an engine-binlog internal hash.

At XA COMMIT, fetch the OOB reference from the internal hash and put it into
a COMMIT record for the transaction.

For both user XA and internal two-phase commit between binlog and
other storage engine, write the XID into an XA complete event in the
same mtr as the commit record. This record will be later used to be
able to consistently recover (commit or rollback) prepared
transactions in the other engines, depending on whether binlog write
became durable before the crash or not.

At XA ROLLBACK, merely put in an XA complete event.

Maintain reference counts for prending prepared XA transactions, and
for pending two-phase commit records, to make sure binlog files
containing these will not be purged while those transactions are
active.

Implement the necessary "unlog" mechanisms so that the reference
counts can be released only after all other participating engines have
durably committed (respectively XA prepared/rolled back) their part of
the transaction.

This commit does not handle XA/binlog crash recovery, will come in a later
patch.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2026-01-16 23:05:04 +01:00

20 lines
669 B
Text

if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'spider' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
{
--skip Test requires Spider engine
}
--source include/have_binlog_format_mixed.inc
--source include/have_innodb_binlog.inc
SET spider_same_server_link= on;
--evalp create server s foreign data wrapper mysql options (host "127.0.0.1", database "spider_db", user "root", port $MASTER_MYPORT);
CREATE DATABASE spider_db;
CREATE TABLE spider_db.t (a INT) ENGINE=InnoDB;
CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "s", table "t"';
INSERT INTO t VALUES (2);
DROP TABLE t;
DROP DATABASE spider_db;
DROP SERVER s;