mariadb/mysql-test/main/xa_binlog.result
Monty 4102f1589c Aria will now register it's transactions
MDEV-22531 Remove maria::implicit_commit()
MDEV-22607 Assertion `ha_info->ht() != binlog_hton' failed in
           MYSQL_BIN_LOG::unlog_xa_prepare

From the handler point of view, Aria now looks like a transactional
engine. One effect of this is that we don't need to call
maria::implicit_commit() anymore.

This change also forces the server to call trans_commit_stmt() after doing
any read or writes to system tables.  This work will also make it easier
to later allow users to have system tables in other engines than Aria.

To handle the case that Aria doesn't support rollback, a new
handlerton flag, HTON_NO_ROLLBACK, was added to engines that has
transactions without rollback (for the moment only binlog and Aria).

Other things
- Moved freeing of MARIA_SHARE to a separate function as the MARIA_SHARE
  can be still part of a transaction even if the table has closed.
- Changed Aria checkpoint to use the new MARIA_SHARE free function. This
  fixes a possible memory leak when using S3 tables
- Changed testing of binlog_hton to instead test for HTON_NO_ROLLBACK
- Removed checking of has_transaction_manager() in handler.cc as we can
  assume that as the transaction was started by the engine, it does
  support transactions.
- Added new class 'start_new_trans' that can be used to start indepdendent
  sub transactions, for example while reading mysql.proc, using help or
  status tables etc.
- open_system_tables...() and open_proc_table_for_Read() doesn't anymore
  take a Open_tables_backup list. This is now handled by 'start_new_trans'.
- Split thd::has_transactions() to thd::has_transactions() and
  thd::has_transactions_and_rollback()
- Added handlerton code to free cached transactions objects.
  Needed by InnoDB.

squash! 2ed35999f2a2d84f1c786a21ade5db716b6f1bbc
2020-05-23 12:29:10 +03:00

85 lines
3 KiB
Text

CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET binlog_format= mixed;
RESET MASTER;
XA START 'xatest';
INSERT INTO t1 VALUES (1);
XA END 'xatest';
XA PREPARE 'xatest';
XA COMMIT 'xatest';
XA START 'xatest';
INSERT INTO t1 VALUES (2);
XA END 'xatest';
XA COMMIT 'xatest' ONE PHASE;
BEGIN;
INSERT INTO t1 VALUES (3);
COMMIT;
SELECT * FROM t1 ORDER BY a;
a
1
2
3
DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=Aria;
INSERT INTO t1 VALUES (1),(2);
XA BEGIN 'x';
DELETE FROM t1;
XA END 'x';
XA PREPARE 'x';
Warnings:
Warning 1030 Got error 131 "Command not supported by the engine" from storage engine Aria
XA COMMIT 'x';
SELECT * from t1;
a
XA BEGIN 'x';
INSERT INTO t1 VALUES (3),(4);
XA END 'x';
XA PREPARE 'x';
Warnings:
Warning 1030 Got error 131 "Command not supported by the engine" from storage engine Aria
XA ROLLBACK 'x';
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
SELECT * from t1;
a
3
4
DROP TABLE t1;
SHOW BINLOG EVENTS LIMIT 3,100;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid 1 # XA START X'786174657374',X'',1 GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
master-bin.000001 # Query 1 # XA END X'786174657374',X'',1
master-bin.000001 # XA_prepare 1 # XA PREPARE X'786174657374',X'',1
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # XA COMMIT X'786174657374',X'',1
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (2)
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (3)
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT) ENGINE=Aria
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1),(2)
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Query 1 # use `test`; DELETE FROM t1
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # XA START X'78',X'',1 GTID #-#-#
master-bin.000001 # Query 1 # XA END X'78',X'',1
master-bin.000001 # XA_prepare 1 # XA PREPARE X'78',X'',1
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # XA COMMIT X'78',X'',1
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (3),(4)
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # XA START X'78',X'',1 GTID #-#-#
master-bin.000001 # Query 1 # XA END X'78',X'',1
master-bin.000001 # XA_prepare 1 # XA PREPARE X'78',X'',1
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # XA ROLLBACK X'78',X'',1
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */