mariadb/mysql-test/suite/binlog_in_engine/binlog_legacy_pos.test
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

85 lines
3.1 KiB
Text

--source include/have_binlog_format_mixed.inc
--source include/have_innodb_binlog.inc
--source include/reset_master.inc
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 0);
--connect(con1,localhost,root,,)
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connect(con2,localhost,root,,)
--echo *** Connection sees current position by default.
--connection default
INSERT INTO t1 VALUES (2, 0);
FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (3, 0);
--let $binlog_file= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_file', Value, 1)
--let $binlog_start= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
--let $binlog_limit= 0, 3
INSERT INTO t1 VALUES (4, 0);
SELECT * FROM t1 ORDER BY a;
--source include/show_binlog_events.inc
--echo *** START TRANSACTION WITH CONSISTENT SNAPSHOT sees position consistent with read view.
--connection con1
--let $binlog_file= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_file', Value, 1)
--let $binlog_start= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
SELECT * FROM t1 ORDER BY a;
--source include/show_binlog_events.inc
--echo *** Connection with no active transaction sees the current position.
--connection con2
--let $binlog_file= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_file', Value, 1)
--let $binlog_start= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
--connection default
INSERT INTO t1 VALUES (5, 0);
--connection con2
SELECT * FROM t1 ORDER BY a;
--source include/show_binlog_events.inc
--echo *** Test some various conditions around SHOW BINLOG EVENTS.
--let $binlog_name= binlog-000002.ibb
--let $binlog_size= 262144
--source include/wait_for_engine_binlog.inc
# Non-existing file.
--error ER_ERROR_WHEN_EXECUTING_COMMAND
SHOW BINLOG EVENTS IN 'binlog-000003.ibb';
--error ER_ERROR_WHEN_EXECUTING_COMMAND
SHOW BINLOG EVENTS IN 'binlog-000003.ibb' FROM 1234567890;
# In-between offset starts from first following GTID.
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 0 LIMIT 1;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 4 LIMIT 1;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 42 LIMIT 1;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 3000 LIMIT 1;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 16384 LIMIT 1;
SHOW BINLOG EVENTS IN 'binlog-000001.ibb' FROM 16384 LIMIT 1;
SHOW BINLOG EVENTS IN 'binlog-000001.ibb' FROM 16400 LIMIT 1;
# Offset past end of file shows empty.
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 32768;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 32769;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 262144;
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 2000000000;
# Non-binlog file name
--error ER_UNKNOWN_TARGET_BINLOG
SHOW BINLOG EVENTS IN 'binlog--000012.ibb';
--error ER_UNKNOWN_TARGET_BINLOG
SHOW BINLOG EVENTS IN 'abadcafe.ibb';
# Purged binlog file.
SET @old_needed= @@GLOBAL.slave_connections_needed_for_purge;
SET GLOBAL slave_connections_needed_for_purge= 0;
PURGE BINARY LOGS TO 'binlog-000001.ibb';
SET GLOBAL slave_connections_needed_for_purge= @old_needed;
--error 29
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' LIMIT 10;
--connection default
--disconnect con1
--disconnect con2
DROP TABLE t1;