mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 14:32:34 +01:00
3ab71376ce
NOTE: Backporting the patch to next-mr. The fix proposed in BUG#35542 and BUG#31665 introduces a performance issue when fsyncing the master.info, relay.info and relay-log.bin* after #th events. Although such solution has been proposed to reduce the probability of corrupted files due to a slave-crash, the performance penalty introduced by it has made the approach impractical for highly intensive workloads. In a nutshell, the option --syn-relay-log proposed in BUG#35542 and BUG#31665 simultaneously fsyncs master.info, relay-log.info and relay-log.bin* and this is the main source of performance issues. This patch introduces new options that give more control to the user on what should be fsynced and how often: 1) (--sync-master-info, integer) which syncs the master.info after #th event; 2) (--sync-relay-log, integer) which syncs the relay-log.bin* after #th events. 3) (--sync-relay-log-info, integer) which syncs the relay.info after #th transactions. To provide both performance and increased reliability, we recommend the following setup: 1) --sync-master-info = 0 eventually the operating system will fsync it; 2) --sync-relay-log = 0 eventually the operating system will fsync it; 3) --sync-relay-log-info = 1 fsyncs it after every transaction; Notice, that the previous setup does not reduce the probability of corrupted master.info and relay-log.bin*. To overcome the issue, this patch also introduces a recovery mechanism that right after restart throws away relay-log.bin* retrieved from a master and updates the master.info based on the relay.info: 4) (--relay-log-recovery, boolean) which enables a recovery mechanism that throws away relay-log.bin* after a crash. However, it can only recover the incorrect binlog file and position in master.info, if other informations (host, port password, etc) are corrupted or incorrect, then this recovery mechanism will fail to work.
40 lines
1.4 KiB
Text
40 lines
1.4 KiB
Text
=====Configuring the enviroment=======;
|
|
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;
|
|
call mtr.add_suppression('Attempting backtrace');
|
|
call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001");
|
|
CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb;
|
|
insert into t1(a) values(1);
|
|
insert into t1(a) values(2);
|
|
insert into t1(a) values(3);
|
|
=====Inserting data on the master but without the SQL Thread being running=======;
|
|
stop slave SQL_THREAD;
|
|
insert into t1(a) values(4);
|
|
insert into t1(a) values(5);
|
|
insert into t1(a) values(6);
|
|
=====Removing relay log files and crashing/recoverying the slave=======;
|
|
stop slave IO_THREAD;
|
|
SET SESSION debug="d,crash_before_rotate_relaylog";
|
|
FLUSH LOGS;
|
|
ERROR HY000: Lost connection to MySQL server during query
|
|
=====Dumping and comparing tables=======;
|
|
start slave;
|
|
Comparing tables master:test.t1 and slave:test.t1
|
|
=====Corrupting the master.info=======;
|
|
stop slave;
|
|
FLUSH LOGS;
|
|
insert into t1(a) values(7);
|
|
insert into t1(a) values(8);
|
|
insert into t1(a) values(9);
|
|
SET SESSION debug="d,crash_before_rotate_relaylog";
|
|
FLUSH LOGS;
|
|
ERROR HY000: Lost connection to MySQL server during query
|
|
=====Dumping and comparing tables=======;
|
|
start slave;
|
|
Comparing tables master:test.t1 and slave:test.t1
|
|
=====Clean up=======;
|
|
drop table t1;
|