mariadb/mysql-test/suite/binlog_in_engine/xa_restart2.result
Kristian Nielsen 7081f2a58e Binlog-in-engine: New binlog implementation integrated in InnoDB
Implement an improved binlog implementation that is integrated into
the storage engine. The new implementation is enabled with the
--binlog-storage-engine option. Initially the InnoDB storage engine
implements the binlog.

Integrating the binlog in the storage engine improves performance,
since it makes the InnoDB redo log the single source of truth and
avoids the need for expensive two-phase commit between binlog and
engine. It also makes it possible to disable durability (set
--innodb-flush-log-at-trx-commit=0) to further improve performance,
while still preserving the ability to recover the binlog and database
into a consistent state after a crash.

The new binlog implementation also greatly improves the internal
design and implementation of the binlog, and enables future
enhancements for replication.

This is a squash of the original 11.4-based patch series.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2026-01-23 03:21:03 +01:00

169 lines
4 KiB
Text

include/master-slave.inc
[connection master]
*** Test XA PREPARE preserved over server restart.
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, c LONGBLOB, PRIMARY KEY(a, b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0, 1, '');
INSERT INTO t1 VALUES (0, 2, '');
INSERT INTO t1 VALUES (0, 3, '');
connect con1,localhost,root,,;
XA BEGIN 'x1';
INSERT INTO t1 VALUES (1, 1, '');
connect con2,localhost,root,,;
XA BEGIN 'x2';
INSERT INTO t1 VALUES (2, 1, REPEAT('2', 100000));
connect con3,localhost,root,,;
XA BEGIN 'x3';
INSERT INTO t1 VALUES (3, 1, '');
connection con1;
INSERT INTO t1 VALUES (1, 2, '');
connection con2;
INSERT INTO t1 VALUES (2, 2, REPEAT('2', 40000));
connection con3;
INSERT INTO t1 VALUES (3, 2, REPEAT('3', 50000));
connection con2;
INSERT INTO t1 VALUES (2, 3, REPEAT('2', 40000));
connection con3;
INSERT INTO t1 VALUES (3, 3, REPEAT('3', 100000));
INSERT INTO t1 VALUES (3, 4, REPEAT('3', 100000));
INSERT INTO t1 VALUES (3, 5, REPEAT('3', 100000));
INSERT INTO t1 VALUES (3, 6, REPEAT('3', 100000));
connection con2;
INSERT INTO t1 VALUES (2, 4, REPEAT('2', 40000));
connection con1;
INSERT INTO t1 VALUES (1, 3, '');
XA END 'x1';
XA PREPARE 'x1';
connection con2;
XA END 'x2';
XA PREPARE 'x2';
connection con3;
INSERT INTO t1 VALUES (3, 7, '');
XA END 'x3';
XA PREPARE 'x3';
connection slave;
include/stop_slave.inc
connection master;
include/rpl_restart_server.inc [server_number=1]
disconnect con1;
disconnect con2;
disconnect con3;
connection slave;
include/start_slave.inc
connection master;
XA RECOVER;
formatID gtrid_length bqual_length data
1 2 0 x1
1 2 0 x2
1 2 0 x3
XA COMMIT 'x1';
XA ROLLBACK 'x2';
XA COMMIT 'x3';
SELECT a, b, LENGTH(c) FROM t1 ORDER BY a,b;
a b LENGTH(c)
0 1 0
0 2 0
0 3 0
1 1 0
1 2 0
1 3 0
3 1 0
3 2 50000
3 3 100000
3 4 100000
3 5 100000
3 6 100000
3 7 0
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
SELECT a, b, LENGTH(c) FROM t1 ORDER BY a,b;
a b LENGTH(c)
0 1 0
0 2 0
0 3 0
1 1 0
1 2 0
1 3 0
3 1 0
3 2 50000
3 3 100000
3 4 100000
3 5 100000
3 6 100000
3 7 0
*** Test purgability of binlogs containing XA oob after restart.
connection slave;
include/stop_slave.inc
connection master;
include/reset_master.inc
connect con1,localhost,root,,;
XA START 'x4';
INSERT INTO t1 VALUES (4, 1, REPEAT('4', 40000));
connection master;
FLUSH BINARY LOGS;
connect con2,localhost,root,,;
XA START 'x5';
INSERT INTO t1 VALUES (5, 1, REPEAT('5', 40000));
XA END 'x5';
XA PREPARE 'x5';
connection master;
FLUSH BINARY LOGS;
connect con3,localhost,root,,;
XA START 'x6';
INSERT INTO t1 VALUES (6, 1, 'x6');
XA END 'x6';
XA PREPARE 'x6';
connection con1;
XA END 'x4';
XA PREPARE 'x4';
connection master;
include/rpl_restart_server.inc [server_number=1]
disconnect con1;
disconnect con2;
disconnect con3;
connection slave;
SET GLOBAL gtid_slave_pos= '';
include/start_slave.inc
connection master;
XA RECOVER;
formatID gtrid_length bqual_length data
1 2 0 x4
1 2 0 x5
1 2 0 x6
SET @old_min_slaves= @@GLOBAL.slave_connections_needed_for_purge;
SET GLOBAL slave_connections_needed_for_purge= 1;
FLUSH BINARY LOGS;
PURGE BINARY LOGS TO 'binlog-000001.ibb';
ERROR HY000: A purgeable log is in use, will not purge
XA COMMIT 'x4';
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection master;
PURGE BINARY LOGS TO 'binlog-000001.ibb';
PURGE BINARY LOGS TO 'binlog-000002.ibb';
ERROR HY000: A purgeable log is in use, will not purge
XA ROLLBACK 'x5';
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection master;
PURGE BINARY LOGS TO 'binlog-000002.ibb';
FLUSH BINARY LOGS;
PURGE BINARY LOGS TO 'binlog-000003.ibb';
ERROR HY000: A purgeable log is in use, will not purge
XA COMMIT 'x6';
FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (7, 1, '');
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection master;
PURGE BINARY LOGS TO 'binlog-000003.ibb';
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection master;
SET GLOBAL slave_connections_needed_for_purge= @old_min_slaves;
DROP TABLE t1;
include/rpl_end.inc