1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
SET @@global.max_binlog_size= 4096;
call mtr.add_suppression("Table '.*tm' is marked as crashed and should be repaired");
call mtr.add_suppression("Got an error from unknown thread");
call mtr.add_suppression("Checking table: '.*tm'");
call mtr.add_suppression("Recovering table: '.*tm'");
call mtr.add_suppression("Cannot truncate the binary log to file");
call mtr.add_suppression("Crash recovery failed");
call mtr.add_suppression("Can.t init tc log");
call mtr.add_suppression("Aborting");
call mtr.add_suppression("Found 1 prepared transactions");
call mtr.add_suppression("mysqld: Table.*tm.*is marked as crashed");
call mtr.add_suppression("Checking table.*tm");
RESET MASTER;
FLUSH LOGS;
SET @@global.sync_binlog=1;
CREATE TABLE ti (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
CREATE TABLE tm (f INT) ENGINE=MYISAM;
INSERT INTO tm VALUES(1);
connect master1,localhost,root,,;
connect master2,localhost,root,,;
connect master3,localhost,root,,;
connection master1;
SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL master1_ready WAIT_FOR master1_go_never_arrives";
INSERT INTO ti VALUES (5 - 1, REPEAT("x", 4100));
connection master2;
SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master2_ready WAIT_FOR master2_go_never_arrives";
INSERT INTO ti VALUES (5, REPEAT("x", 1));
connection master3;
SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master3_ready";
INSERT INTO tm VALUES (2);
connection default;
SET DEBUG_SYNC= "now WAIT_FOR master3_ready";
# The gtid binlog state prior the crash must be restored at the end of the test;
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
0-1-9
# Kill the server
# Failed restart as the semisync slave
# Normal restart
# restart
FOUND 1 /Cannot truncate the binary log to file/ in mysqld.1.err
# Proof that the in-doubt transactions are recovered by the 2nd normal server restart
SELECT COUNT(*) = 5 as 'True' FROM ti;
True
1
SELECT COUNT(*) <= 1 FROM tm;
COUNT(*) <= 1
1
# The gtid binlog state prior the crash is restored now
SELECT @@GLOBAL.gtid_binlog_state;
@@GLOBAL.gtid_binlog_state
0-1-9
SELECT @@GLOBAL.gtid_binlog_pos;
@@GLOBAL.gtid_binlog_pos
0-1-9
# Cleanup
DROP TABLE ti, tm;
End of test
|