mirror of
https://github.com/MariaDB/server.git
synced 2026-02-09 20:28:41 +01:00
If binlog files are deleted or otherwise unreadable during server restart, don't make the server unstartable. Instead, start up, recovering what is available, but complaining in the error log. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
78 lines
2.3 KiB
Text
78 lines
2.3 KiB
Text
--source include/have_binlog_format_row.inc
|
|
--source include/have_innodb_binlog.inc
|
|
|
|
--let $datadir= `SELECT @@datadir`
|
|
--source include/reset_master.inc
|
|
|
|
--echo *** Test that a prepare record at the end of binlog does not cause server shutdown to hang
|
|
CALL mtr.add_suppression('Warning.*Found 1 prepared XA transactions');
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
|
|
|
|
XA START 'a';
|
|
INSERT INTO t1 VALUES (1, REPEAT('<', 50000));
|
|
INSERT INTO t1 VALUES (2, REPEAT('|', 50000));
|
|
INSERT INTO t1 VALUES (3, REPEAT('>', 50000));
|
|
XA END 'a';
|
|
XA PREPARE 'a';
|
|
|
|
# The bug was that the prepare record written at the current end of
|
|
# the binlog file was not entered into the pending LSN fifo, so it never
|
|
# got marked as having been made durable. Then when the server shuts down
|
|
# and closes the binlog tablespace file, it waits indefinitely for the
|
|
# file to be marked durable.
|
|
--source include/restart_mysqld.inc
|
|
|
|
XA ROLLBACK 'a';
|
|
|
|
--echo *** Test server restart when some binlog files are missing.
|
|
|
|
--source include/reset_master.inc
|
|
|
|
INSERT INTO t1 VALUES (10, REPEAT('a', 100000));
|
|
INSERT INTO t1 VALUES (11, REPEAT('a', 100000));
|
|
INSERT INTO t1 VALUES (12, REPEAT('a', 100000));
|
|
|
|
--connect con1,localhost,root,,
|
|
XA START 'b';
|
|
INSERT INTO t1 VALUES (20, REPEAT('b', 10000));
|
|
XA END 'b';
|
|
XA PREPARE 'b';
|
|
|
|
--connection default
|
|
FLUSH BINARY LOGS;
|
|
|
|
--connect con2,localhost,root,,
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES (21, REPEAT('d', 100000));
|
|
|
|
--connect con3,localhost,root,,
|
|
XA START 'c';
|
|
INSERT INTO t1 VALUES (22, REPEAT('c', 10000));
|
|
XA END 'c';
|
|
XA PREPARE 'c';
|
|
|
|
--connection default
|
|
FLUSH BINARY LOGS;
|
|
INSERT INTO t1 VALUES (30, '');
|
|
|
|
--echo *** Stop the server, then restart it after deleting some still needed binlog files.
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
# The server should still start, but with errors in the log, suppressed below.
|
|
--remove_file $datadir/binlog-000000.ibb
|
|
--remove_file $datadir/binlog-000001.ibb
|
|
|
|
--source include/start_mysqld.inc
|
|
|
|
--disconnect con1
|
|
--disconnect con2
|
|
--disconnect con3
|
|
|
|
--echo *** Should be empty, binlog files needed for XA were deleted.
|
|
XA RECOVER;
|
|
|
|
SELECT a, LENGTH(b) FROM t1 ORDER BY a;
|
|
|
|
DROP TABLE t1;
|
|
CALL mtr.add_suppression('ERROR.*File .* not found');
|
|
CALL mtr.add_suppression('ERROR.*InnoDB: Error reading binlog while recovering XIDs of possibly prepared transactions. Recovery will be incomplete');
|