Debian Codegraph @

mysql-test/suite/binlog/t/binlog_truncate_multi_log.test

raw
1 # ==== Purpose ====
2 #
3 # Test verifies truncation of multiple binary logs.
4 #
5 # ==== References ====
6 # MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server
7
8 --source include/have_innodb.inc
9 --source include/have_debug_sync.inc
10 --source include/have_binlog_format_row.inc
11
12 call mtr.add_suppression("Can.t init tc log");
13 call mtr.add_suppression("Aborting");
14
15 SET @@global.max_binlog_size= 4096;
16 SET @@global.sync_binlog= 1;
17 RESET MASTER;
18 FLUSH LOGS;
19 CREATE TABLE ti (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
20 CREATE TABLE tm (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=MyISAM;
21
22 connect(master1,localhost,root,,);
23 --echo "List of binary logs before rotation"
24 --source include/show_binary_logs.inc
25
26 # Some load to either non- and transactional egines
27 # that should not affect the following recovery:
28 INSERT INTO ti VALUES(1,"I am gonna survive");
29 INSERT INTO tm VALUES(1,"me too!");
30
31 # hold on near engine commit
32 SET DEBUG_SYNC= "commit_after_release_LOCK_after_binlog_sync SIGNAL master1_ready WAIT_FOR master1_go_never_arrives";
33 --send INSERT INTO ti VALUES (2, REPEAT("x", 4100))
34
35 connect(master2,localhost,root,,);
36 # The 2nd trx for recovery, it does not rotate binlog
37 SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
38 SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master2_ready WAIT_FOR master2_go_never_arrives";
39 --send INSERT INTO ti VALUES (3, "not gonna survive")
40
41 --connection default
42 SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
43
44 connect(master3,localhost,root,,);
45 # The 3nd trx for recovery, it won't get into binlog nor therefore recover
46 SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master3_ready WAIT_FOR master3_go_never_arrives";
47 --send INSERT INTO ti VALUES (4, "not gonna be log therefore survive"),(5, "ditto")
48
49 --connection default
50 SET DEBUG_SYNC= "now WAIT_FOR master3_ready";
51
52 --echo "List of binary logs before crash"
53 --source include/show_binary_logs.inc
54 --echo # The gtid binlog state prior the crash will be truncated at the end of the test
55 SELECT @@global.gtid_binlog_state;
56
57 --connection default
58 --source include/kill_mysqld.inc
59 --disconnect master1
60 --disconnect master2
61 --disconnect master3
62
63 #
64 # Server restart
65 #
66 --let $restart_parameters= --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3
67 --source include/start_mysqld.inc
68
69 # Check error log for a successful truncate message.
70 let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
71
72 --let SEARCH_FILE=$log_error_
73 --let SEARCH_PATTERN=truncated binlog file:.*master.*000002
74 --source include/search_pattern_in_file.inc
75
76
77 --echo "One record should be present in table"
78 SELECT * FROM ti;
79
80 --echo # The truncated gtid binlog state
81 SELECT @@global.gtid_binlog_state;
82 SELECT @@global.gtid_binlog_pos;
83
84 --echo # Cleanup
85 DROP TABLE ti;
86 SET @@global.sync_binlog= default;
87 --echo # End of the tests