Debian Codegraph @

mysql-test/suite/rpl/t/rpl_mts_logical_clock_timestamping.test

raw
1 #
2 # The test verifies execution specially timestamped transactions and
3 # erroring out due to inconsistent timestamps found.
4 #
5 --source include/have_debug.inc
6 --source include/master-slave.inc
7 # format - non-specific test is enough to executed in MIXED mode only.
8 --source include/have_binlog_format_mixed.inc
9
10 --connection slave
11 call mtr.add_suppression("Transaction is tagged with inconsistent logical timestamps");
12 call mtr.add_suppression("Cannot execute the current event group in the parallel mode.");
13 #call mtr.add_suppression("Replica I/O: Got fatal error 1236 from source when reading data from binary log");
14
15 --source include/stop_slave.inc
16
17 SET @save_replica_parallel_type = @@GLOBAL.replica_parallel_type;
18 SET @save_replica_parallel_workers = @@GLOBAL.replica_parallel_workers;
19 SET @save_replica_transaction_retries = @@GLOBAL.replica_transaction_retries;
20
21 SET GLOBAL replica_parallel_type = LOGICAL_CLOCK;
22 SET GLOBAL replica_parallel_workers = 3;
23 SET GLOBAL replica_transaction_retries = 0;
24
25 #
26 # Part I. "Rotated" transactions apply correctly.
27 # At times Master generalates last_committed as magic SEQ_UNINIT which
28 # designates the transaction's commit parent is unknown so
29 # it has to be applied in exclusive environment, aka
30 # fallback to sequential mode.
31 #
32
33 # Create a chain of binlogs containing two consequent SEQ_UNINIT last_committed
34 # transactions in one them.
35
36 connect (master2,localhost,root,,);
37
38 --connection master
39 --let $MYSQLD_DATADIR= `select @@datadir`
40 --let $events_file=$MYSQLTEST_VARDIR/tmp/events.sql
41
42 RESET MASTER; # make sure we start from 0000001 binlog
43
44 CREATE TABLE t1 (a int) ENGINE= innodb;
45 INSERT INTO t1 SET a=1;
46
47 --connection master1
48 BEGIN;
49 INSERT INTO t1 SET a=2;
50
51 --connection master2
52 BEGIN;
53 INSERT INTO t1 SET a=3;
54
55 --connection master
56 FLUSH LOGS;
57
58 --connection master1
59 COMMIT;
60 --connection master2
61 COMMIT;
62
63 # two timestamp pair of (0,[12]) must be found.
64 --exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000002 > $events_file
65 --let $grep_file= $events_file
66 --let $grep_pattern= last_committed=0\tsequence_number=[12]
67 --let $grep_output= print_count
68 --source include/grep_pattern.inc
69
70 # Create a chain of binlogs containing two consequent SEQ_UNINIT last_committed
71 # transactions separated by a Rotate event.
72
73 --connection master
74 INSERT INTO t1 SET a=1;
75
76 --connection master1
77 BEGIN;
78 INSERT INTO t1 SET a=2;
79
80 --connection master2
81 BEGIN;
82 INSERT INTO t1 SET a=3;
83
84 --connection master
85 FLUSH LOGS;
86
87 --connection master1
88 COMMIT;
89
90 --connection master
91 FLUSH LOGS;
92
93 --connection master2
94 COMMIT;
95
96 --connection master
97 --send INSERT INTO t1 SET a=1
98 --connection master1
99 --send INSERT INTO t1 SET a=2
100 --connection master2
101 --send INSERT INTO t1 SET a=3
102
103 --connection master
104 --reap
105 --connection master1
106 --reap
107 --connection master2
108 --reap
109
110
111 --connection slave
112 --source include/start_slave.inc
113
114 # Proof of correctess stable execution
115 --connection master
116 --sync_slave_with_master
117
118 --let $diff_tables=master:t1,slave:t1
119 --source include/diff_tables.inc
120
121 #
122 # Part II. Let's feign inconsistent timestamping
123 # to see how Slave expectedly stops.
124 #
125
126 --connection master
127 SET @@session.debug ='+d,feign_commit_parent';
128 INSERT INTO t1 SET a=0;
129 SET @@session.debug ='-d,feign_commit_parent';
130
131 --connection slave
132 --let $slave_sql_errno= convert_error(ER_MTA_CANT_PARALLEL)
133 --source include/wait_for_slave_sql_to_stop.inc
134 --source include/stop_slave_io.inc
135
136
137 # "Manual" recovery to restart anew 'cos of the schrambled event
138 --connection master
139 RESET MASTER;
140
141 --connection slave
142 RESET SLAVE;
143 RESET MASTER;
144 --source include/start_slave.inc
145
146 #
147 # Cleanup
148 #
149 --connection master
150 DROP TABLE t1;
151 --remove_file $events_file
152
153 --sync_slave_with_master
154
155 #--connection slave
156 --source include/stop_slave.inc
157 SET @@GLOBAL.replica_parallel_type= @save_replica_parallel_type;
158 --disable_warnings
159 SET @@GLOBAL.replica_parallel_workers= @save_replica_parallel_workers;
160 --enable_warnings
161 SET @@GLOBAL.replica_transaction_retries= @save_replica_transaction_retries;
162 --source include/start_slave.inc
163
164 --source include/rpl_end.inc
165