Debian Codegraph @

mysql-test/suite/binlog/t/binlog_truncate_active_log.inc

raw
1 connect(master1,localhost,root,,);
2 connect(master2,localhost,root,,);
3 connect(master3,localhost,root,,);
4 connect(master4,localhost,root,,);
5
6 --connection default
7
8 # First to commit few transactions
9 INSERT INTO t VALUES (10);
10 INSERT INTO tm VALUES (10);
11
12 --connection master1
13 # Hold insert after write to binlog and before "run_commit_ordered" in engine
14 SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master1_ready WAIT_FOR signal_never_arrives";
15 --send_eval $query1
16
17 --connection master2
18 SET DEBUG_SYNC= "now WAIT_FOR master1_ready";
19 SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready";
20 --send_eval $query2
21
22 --connection master3
23 SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
24 SELECT @@global.gtid_binlog_pos as 'Before the crash';
25
26 --connection master4
27 # Simulate prepared & not-logged trx; it will never recover.
28 SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives";
29 --send INSERT INTO t4 VALUES (13)
30
31 --connection master3
32 SET DEBUG_SYNC= "now WAIT_FOR master4_ready";
33 SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx';
34
35 --connection default
36 --source include/kill_mysqld.inc
37 --disconnect master1
38 --disconnect master2
39 --disconnect master3
40 --disconnect master4
41
42 #
43 # Server restart
44 #
45 --let $restart_parameters= --init-rpl-role=SLAVE --sync-binlog=1 --log-warnings=3
46 --source include/start_mysqld.inc
47
48 # Check error log for a successful truncate message.
49 --let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err
50
51 --let SEARCH_FILE=$log_error_
52 --let SEARCH_PATTERN=Successfully truncated.*to remove transactions starting from GTID $truncate_gtid_pos
53
54 --source include/search_pattern_in_file.inc
55
56 --echo Pre-crash binlog file content:
57 --let $binlog_file= query_get_value(show binary logs, Log_name, $binlog_file_index)
58 --source include/show_binlog_events.inc
59
60 SELECT @@global.gtid_binlog_pos as 'After the crash';
61 --echo "One row should be present in table 't'"
62 SELECT * FROM t;
63 --echo "No row should be present in table 't4'"
64 SELECT * FROM t4;
65
66 # prepare binlog file index for the next test
67 --inc $binlog_file_index
68
69 # Local cleanup
70 DELETE FROM t;