mirror of
https://github.com/MariaDB/server.git
synced 2026-03-18 06:18:41 +01:00
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>
98 lines
3.9 KiB
Text
98 lines
3.9 KiB
Text
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,,;
|
|
*** Connection sees current position by default.
|
|
connection default;
|
|
INSERT INTO t1 VALUES (2, 0);
|
|
FLUSH BINARY LOGS;
|
|
INSERT INTO t1 VALUES (3, 0);
|
|
INSERT INTO t1 VALUES (4, 0);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 0
|
|
2 0
|
|
3 0
|
|
4 0
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000001.ibb # Gtid # # BEGIN GTID #-#-#
|
|
binlog-000001.ibb # Query # # use `test`; INSERT INTO t1 VALUES (4, 0)
|
|
binlog-000001.ibb # Xid # # COMMIT /* XID */
|
|
*** START TRANSACTION WITH CONSISTENT SNAPSHOT sees position consistent with read view.
|
|
connection con1;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 0
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
|
|
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (2, 0)
|
|
binlog-000000.ibb # Xid # # COMMIT /* XID */
|
|
*** Connection with no active transaction sees the current position.
|
|
connection con2;
|
|
connection default;
|
|
INSERT INTO t1 VALUES (5, 0);
|
|
connection con2;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 0
|
|
2 0
|
|
3 0
|
|
4 0
|
|
5 0
|
|
include/show_binlog_events.inc
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000001.ibb # Gtid # # BEGIN GTID #-#-#
|
|
binlog-000001.ibb # Query # # use `test`; INSERT INTO t1 VALUES (5, 0)
|
|
binlog-000001.ibb # Xid # # COMMIT /* XID */
|
|
*** Test some various conditions around SHOW BINLOG EVENTS.
|
|
SHOW BINLOG EVENTS IN 'binlog-000003.ibb';
|
|
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
|
SHOW BINLOG EVENTS IN 'binlog-000003.ibb' FROM 1234567890;
|
|
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 0 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-1
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 4 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-1
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 42 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-1
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 3000 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-1
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 16384 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-1
|
|
SHOW BINLOG EVENTS IN 'binlog-000001.ibb' FROM 16384 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000001.ibb 0 Gtid 1 0 BEGIN GTID 0-1-4
|
|
SHOW BINLOG EVENTS IN 'binlog-000001.ibb' FROM 16400 LIMIT 1;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
binlog-000001.ibb 0 Gtid 1 0 BEGIN GTID 0-1-5
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 32768;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 32769;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 262144;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' FROM 2000000000;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
SHOW BINLOG EVENTS IN 'binlog--000012.ibb';
|
|
ERROR HY000: Target log not found in binlog index
|
|
SHOW BINLOG EVENTS IN 'abadcafe.ibb';
|
|
ERROR HY000: Target log not found in binlog index
|
|
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;
|
|
SHOW BINLOG EVENTS IN 'binlog-000000.ibb' LIMIT 10;
|
|
ERROR HY000: File './binlog-000000.ibb' not found (Errcode: 2 "No such file or directory")
|
|
connection default;
|
|
disconnect con1;
|
|
disconnect con2;
|
|
DROP TABLE t1;
|