mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
MDEV-26473 fixed a segmentation fault at startup between the handle manager thread and the binlog background thread, such that the binlog background thread could be started and submit a job to the handle manager, before it had initialized. Where MDEV-26473 made it so the handle manager would initialize before the main thread started the normal binary logs, it did not account for the recovery case. That is, there is still a possibility of a segmentation fault when a server is recovering using the binary logs such that it can open the binary logs, start the binlog background thread, and submit a job to the handle manager before it is initialized. This patch fixes this by moving the initialization of the mysql handler manager to happen prior to recovery. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
59 lines
2.2 KiB
Plaintext
59 lines
2.2 KiB
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
connection master;
|
|
# Create a GTID event so the binlog background thread will submit a
|
|
# mysql handler job the next time mysqld is restarted.
|
|
create table t1 (a int);
|
|
include/save_master_gtid.inc
|
|
connection slave;
|
|
include/sync_with_master_gtid.inc
|
|
# Set a debug point that forces the main mysqld thread to sleep before
|
|
# anything is initialized for the mysql handle manager
|
|
# Restart the slave mysqld instance so it re-initializes with the
|
|
# binlog background thread submitting a mysql handler job and the
|
|
# mysql handler initialization suspending for a second. Without the fix
|
|
# associated with this test/patch, the following restart will error
|
|
# with a failed assertion.
|
|
include/rpl_restart_server.inc [server_number=2 parameters: --debug_dbug="+d,delay_start_handle_manager"]
|
|
include/start_slave.inc
|
|
#
|
|
# MDEV-33799
|
|
# Ensure that when the binary log is used for recovery (as tc log), that
|
|
# the recovery process cannot start the binlog background thread before
|
|
# the mysql handle manager has started.
|
|
connection slave;
|
|
# Add test suppresssions so crash recovery messages don't fail the test
|
|
set session sql_log_bin=0;
|
|
call mtr.add_suppression("mariadbd: Got error '145.*");
|
|
call mtr.add_suppression("Checking table:.*");
|
|
call mtr.add_suppression("mysql.gtid_slave_pos:.*hasn't closed the table properly");
|
|
call mtr.add_suppression("Can't init tc log");
|
|
call mtr.add_suppression("Aborting");
|
|
set session sql_log_bin=1;
|
|
# Create slave-side only table
|
|
create table t2 (a int) engine=innodb;
|
|
# Crash mariadbd when binlogging transaction to corrupt database state
|
|
connection slave1;
|
|
set @@session.debug_dbug="+d,crash_before_writing_xid";
|
|
insert into t2 values (1);
|
|
connection slave;
|
|
connection slave1;
|
|
Got one of the listed errors
|
|
# Restart mariadbd in recovery mode. Note --tc-heuristic-recover
|
|
# forces mysqld to exit with error, so we run mariadbd via CLI
|
|
# MYSQLD_LAST_CMD --debug_dbug="+d,delay_start_handle_manager" --tc-heuristic-recover=COMMIT
|
|
connection server_2;
|
|
connection slave1;
|
|
connection slave;
|
|
include/start_slave.inc
|
|
#
|
|
# Cleanup
|
|
#
|
|
connection master;
|
|
drop table t1;
|
|
include/save_master_gtid.inc
|
|
connection slave;
|
|
include/sync_with_master_gtid.inc
|
|
drop table t2;
|
|
include/rpl_end.inc
|