1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-34705: Binlog-in-engine: First working recovery

Still needs more testing.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen
2025-03-12 16:57:42 +01:00
parent 1582a6d885
commit b3c6bbdbd3
9 changed files with 934 additions and 129 deletions

View File

@@ -16,25 +16,25 @@ SELECT @@GLOBAL.binlog_checksum;
NONE
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
binlog-000000.ibb 767
SHOW BINLOG EVENTS IN "binlog-000000.ibb";
binlog-000000.ibb #
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-1
binlog-000000.ibb 0 Query 1 0 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
binlog-000000.ibb 0 Gtid 1 0 BEGIN GTID 0-1-2
binlog-000000.ibb 0 Query 1 0 use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb 0 Xid 1 0 COMMIT /* xid=34 */
binlog-000000.ibb 0 Gtid 1 0 BEGIN GTID 0-1-3
binlog-000000.ibb 0 Query 1 0 use `test`; INSERT INTO t1 VALUES (2)
binlog-000000.ibb 0 Query 1 0 use `test`; INSERT INTO t1 VALUES (3)
binlog-000000.ibb 0 Xid 1 0 COMMIT /* xid=36 */
binlog-000000.ibb 0 Gtid 1 0 GTID 0-1-4
binlog-000000.ibb 0 Query 1 0 use `test`; DROP TABLE `t1` /* generated by server */
SHOW BINLOG EVENTS LIMIT 2, 3;
binlog-000000.ibb # Gtid # # GTID #-#-#
binlog-000000.ibb # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (2)
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (3)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # GTID #-#-#
binlog-000000.ibb # Query # # use `test`; DROP TABLE `t1` /* generated by server */
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog-000000.ibb 0 Gtid 1 0 BEGIN GTID 0-1-2
binlog-000000.ibb 0 Query 1 0 use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb 0 Xid 1 0 COMMIT /* xid=34 */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb # Xid # # COMMIT /* XID */
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(2048)) ENGINE=InnoDB;
SET SESSION binlog_format= ROW;
*** Do 1500 transactions ...

View File

@@ -27,9 +27,14 @@ SELECT @@GLOBAL.binlog_checksum;
# If this gets too annoying to do, we can replace this with something that
# checks that the reported file and position is within some reasonable range
# of the value left by current code.
--replace_column 2 #
SHOW MASTER STATUS;
SHOW BINLOG EVENTS IN "binlog-000000.ibb";
SHOW BINLOG EVENTS LIMIT 2, 3;
--let $binlog_file= binlog-000000.ibb
--let $binlog_start= 0
--source include/show_binlog_events.inc
--let $binlog_file=
--let $binlog_limit= 2, 3
--source include/show_binlog_events.inc
CREATE TABLE t2 (a INT PRIMARY KEY, b VARCHAR(2048)) ENGINE=InnoDB;

View File

@@ -0,0 +1,56 @@
RESET MASTER;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
# Flush all dirty pages from buffer pool
SET @no_checkpoint_save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
SET @no_checkpoint_save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
SET GLOBAL innodb_max_dirty_pages_pct= @no_checkpoint_save_pct;
SET GLOBAL innodb_max_dirty_pages_pct_lwm= @no_checkpoint_save_pct_lwm;
BEGIN;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
COMMIT;
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
5
6
7
SET SESSION debug_dbug="+d,crash_dispatch_command_before";
SELECT 1;
Got one of the listed errors
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog-000000.ibb # Gtid # # GTID #-#-#
binlog-000000.ibb # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (2)
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (3)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (4)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (5)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (6)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (7)
binlog-000000.ibb # Xid # # COMMIT /* XID */
DROP TABLE t1;

View File

@@ -14,7 +14,6 @@ INSERT INTO t1 VALUES (1);
--let $no_checkpoint_flush= 1
--let $no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_start.inc
SHOW MASTER STATUS;
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)
@@ -23,8 +22,11 @@ BEGIN;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
COMMIT;
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
# Crash the server
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@@ -55,5 +57,7 @@ EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
SHOW MASTER STATUS;
SHOW BINLOG EVENTS;
--let $binlog_file=
--let $binlog_start= 0
--source include/show_binlog_events.inc
DROP TABLE t1;