mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
BUG#38826 Race in MYSQL_LOG::purge_logs is impossible to debug in production
BUG#39325 Server crash inside MYSQL_LOG::purge_first_log halts replicaiton The patch reverses the order of the purging and updating events for log and relay-log.info/index files respectively. This solves the problem of having holes caused by crashes happening between updating info/index files and purging logs. This patch also contains an aditional test case for testing the crashing before purge logs. NOTE1: This is a combined patch for BUG#38826 and BUG#39325. This patch is based on bugteam tree and takes into account reviewers suggestions. NOTE2: Merge from 5.0-bugteam
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
let $counter= 500;
|
||||
while ($mysql_errno)
|
||||
{
|
||||
--error 0,2002,2006
|
||||
--error 0,2002,2006,2003
|
||||
show status;
|
||||
|
||||
dec $counter;
|
||||
|
@@ -21,6 +21,7 @@ flush logs;
|
||||
*** must be a warning master-bin.000001 was not found ***
|
||||
Warnings:
|
||||
Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
|
||||
Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
|
||||
*** must show one record, of the active binlog, left in the index file after PURGE ***
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
|
14
mysql-test/suite/rpl/r/rpl_crash_before_purge_logs.result
Normal file
14
mysql-test/suite/rpl/r/rpl_crash_before_purge_logs.result
Normal file
@@ -0,0 +1,14 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
stop slave;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (id INT);
|
||||
start slave;
|
||||
SET GLOBAL debug= "+d,crash_before_purge_logs";
|
||||
FLUSH LOGS;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
start slave;
|
57
mysql-test/suite/rpl/t/rpl_crash_before_purge_logs.test
Normal file
57
mysql-test/suite/rpl/t/rpl_crash_before_purge_logs.test
Normal file
@@ -0,0 +1,57 @@
|
||||
--source include/master-slave.inc
|
||||
--source include/have_debug.inc
|
||||
--disable_reconnect
|
||||
|
||||
# We have to sync with master, to ensure slave had time to start properly
|
||||
# # before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the
|
||||
# log.
|
||||
sync_slave_with_master;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
|
||||
# ON MASTER
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (id INT);
|
||||
|
||||
let $1=100;
|
||||
disable_query_log;
|
||||
begin;
|
||||
while ($1)
|
||||
{
|
||||
eval INSERT INTO t1 VALUES( $1 );
|
||||
dec $1;
|
||||
}
|
||||
DROP TABLE t1;
|
||||
save_master_pos;
|
||||
|
||||
enable_query_log;
|
||||
|
||||
## ON SLAVE
|
||||
|
||||
connection slave;
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
sync_with_master 0;
|
||||
connection master;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
|
||||
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/slave0.expect
|
||||
SET GLOBAL debug= "+d,crash_before_purge_logs";
|
||||
|
||||
--error 2013
|
||||
# try to rotate logs
|
||||
FLUSH LOGS;
|
||||
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
start slave;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
sync_with_master 0;
|
Reference in New Issue
Block a user