| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection slave; |
| 4 |
call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase"); |
| 5 |
include/stop_slave.inc |
| 6 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 7 |
SET @@global.gtid_pos_auto_engines="innodb"; |
| 8 |
include/start_slave.inc |
| 9 |
connection master; |
| 10 |
create table t1 (a int, b int) engine=InnoDB; |
| 11 |
insert into t1 values(0, 0); |
| 12 |
xa start 't'; |
| 13 |
insert into t1 values(1, 2); |
| 14 |
xa end 't'; |
| 15 |
xa prepare 't'; |
| 16 |
xa commit 't'; |
| 17 |
connection slave; |
| 18 |
include/diff_tables.inc [master:t1, slave:t1] |
| 19 |
connection master; |
| 20 |
xa start 't'; |
| 21 |
insert into t1 values(3, 4); |
| 22 |
xa end 't'; |
| 23 |
xa prepare 't'; |
| 24 |
xa rollback 't'; |
| 25 |
connection slave; |
| 26 |
include/diff_tables.inc [master:t1, slave:t1] |
| 27 |
connection master; |
| 28 |
SET pseudo_slave_mode=1; |
| 29 |
create table t2 (a int) engine=InnoDB; |
| 30 |
xa start 't'; |
| 31 |
insert into t1 values (5, 6); |
| 32 |
xa end 't'; |
| 33 |
xa prepare 't'; |
| 34 |
xa start 's'; |
| 35 |
insert into t2 values (0); |
| 36 |
xa end 's'; |
| 37 |
xa prepare 's'; |
| 38 |
Warnings: |
| 39 |
Warning 4205 Pseudo thread id should not be modified by the client as it will be overwritten |
| 40 |
include/save_master_gtid.inc |
| 41 |
connection slave; |
| 42 |
include/sync_with_master_gtid.inc |
| 43 |
SELECT @@global.gtid_slave_pos = CONCAT(domain_id,"-",server_id,"-",seq_no) FROM mysql.gtid_slave_pos WHERE seq_no = (SELECT DISTINCT max(seq_no) FROM mysql.gtid_slave_pos); |
| 44 |
@@global.gtid_slave_pos = CONCAT(domain_id,"-",server_id,"-",seq_no) |
| 45 |
1 |
| 46 |
xa recover; |
| 47 |
formatID gtrid_length bqual_length data |
| 48 |
1 1 0 s |
| 49 |
1 1 0 t |
| 50 |
connection master; |
| 51 |
xa commit 't'; |
| 52 |
xa commit 's'; |
| 53 |
SET pseudo_slave_mode=0; |
| 54 |
connection slave; |
| 55 |
include/diff_tables.inc [master:t1, slave:t1] |
| 56 |
include/diff_tables.inc [master:t2, slave:t2] |
| 57 |
connection master; |
| 58 |
*** At the start of read-only section gtid list is: |
| 59 |
flush logs; |
| 60 |
show binlog events in 'master-bin.000002' limit 1,1; |
| 61 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 62 |
master-bin.000002 # Gtid_list 1 # [0-1-11] |
| 63 |
set @query1="select 1"; |
| 64 |
set @query2="select count(*) into @s2 from t1"; |
| 65 |
connection master; |
| 66 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 67 |
xa start 'ro_2'; |
| 68 |
select count(*) into @s2 from t1; |
| 69 |
xa end 'ro_2'; |
| 70 |
xa prepare 'ro_2';; |
| 71 |
disconnect master_ro_2; |
| 72 |
connection master; |
| 73 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 74 |
xa start 'ro_1'; |
| 75 |
select 1; |
| 76 |
1 |
| 77 |
1 |
| 78 |
xa end 'ro_1'; |
| 79 |
xa prepare 'ro_1';; |
| 80 |
disconnect master_ro_1; |
| 81 |
connection master; |
| 82 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 83 |
xa start 'ro_2'; |
| 84 |
select count(*) into @s2 from t1; |
| 85 |
xa end 'ro_2'; |
| 86 |
xa prepare 'ro_2';; |
| 87 |
disconnect master_ro_2; |
| 88 |
connection master; |
| 89 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 90 |
xa start 'ro_1'; |
| 91 |
select 1; |
| 92 |
1 |
| 93 |
1 |
| 94 |
xa end 'ro_1'; |
| 95 |
xa prepare 'ro_1';; |
| 96 |
disconnect master_ro_1; |
| 97 |
*** 2 prepared xa:s must be in the list: |
| 98 |
connection master; |
| 99 |
xa recover; |
| 100 |
formatID gtrid_length bqual_length data |
| 101 |
1 4 0 ro_1 |
| 102 |
1 4 0 ro_2 |
| 103 |
*** Zero prepared xa:s must be in the list: |
| 104 |
xa recover; |
| 105 |
formatID gtrid_length bqual_length data |
| 106 |
*** At the end of read-only section gtid list has 0 more compare with previous check: |
| 107 |
flush logs; |
| 108 |
show binlog events in 'master-bin.000003' limit 1,1; |
| 109 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 110 |
master-bin.000003 # Gtid_list 1 # [0-1-11] |
| 111 |
create database test_ign; |
| 112 |
set @@sql_log_bin = 0; |
| 113 |
create table test_ign.t (a int) engine=InnoDB; |
| 114 |
set @@sql_log_bin = 1; |
| 115 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 116 |
xa start 'rw_no_binlog'; |
| 117 |
insert into test_ign.t set a=1; |
| 118 |
xa end 'rw_no_binlog'; |
| 119 |
xa prepare 'rw_no_binlog';; |
| 120 |
disconnect master_rw_no_binlog; |
| 121 |
*** rw_no_binlog must be in the list: |
| 122 |
connection master; |
| 123 |
xa recover; |
| 124 |
formatID gtrid_length bqual_length data |
| 125 |
1 12 0 rw_no_binlog |
| 126 |
*** Zero must be in the list: |
| 127 |
connection master; |
| 128 |
xa recover; |
| 129 |
formatID gtrid_length bqual_length data |
| 130 |
*** At the end of --binlog-ignore-db section gtid list has 2 more: |
| 131 |
flush logs; |
| 132 |
show binlog events in 'master-bin.000004' limit 1,1; |
| 133 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 134 |
master-bin.000004 # Gtid_list 1 # [0-1-13] |
| 135 |
connection master; |
| 136 |
create table t3 (a int) engine=innodb; |
| 137 |
*** the disconnected prepare case |
| 138 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 139 |
set @@binlog_format=statement; |
| 140 |
xa start 'rw_binlog_only'; |
| 141 |
delete from t3; |
| 142 |
xa end 'rw_binlog_only'; |
| 143 |
xa prepare 'rw_binlog_only'; |
| 144 |
disconnect master_rw_binlog_only; |
| 145 |
connection master; |
| 146 |
*** rw_binlog_only must be in the list: |
| 147 |
xa recover; |
| 148 |
formatID gtrid_length bqual_length data |
| 149 |
1 14 0 rw_binlog_only |
| 150 |
*** Zero must be in the list: |
| 151 |
xa recover; |
| 152 |
formatID gtrid_length bqual_length data |
| 153 |
*** the same connection complete case. |
| 154 |
connection master; |
| 155 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 156 |
set @@binlog_format=statement; |
| 157 |
xa start 'rw_binlog_only'; |
| 158 |
delete from t3; |
| 159 |
xa end 'rw_binlog_only'; |
| 160 |
xa prepare 'rw_binlog_only'; |
| 161 |
*** rw_binlog_only must be in the list: |
| 162 |
xa recover; |
| 163 |
formatID gtrid_length bqual_length data |
| 164 |
1 14 0 rw_binlog_only |
| 165 |
disconnect master_rw_binlog_only; |
| 166 |
*** Zero must be in the list: |
| 167 |
connection master; |
| 168 |
xa recover; |
| 169 |
formatID gtrid_length bqual_length data |
| 170 |
*** At the end of ineffective in engine section gtid list has 5 more: |
| 171 |
flush logs; |
| 172 |
show binlog events in 'master-bin.000005' limit 1,1; |
| 173 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 174 |
master-bin.000005 # Gtid_list 1 # [0-1-18] |
| 175 |
create table tm (a int) engine=myisam; |
| 176 |
connection master; |
| 177 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 178 |
xa start 'rw_myisam'; |
| 179 |
insert into tm set a=1; |
| 180 |
xa end 'rw_myisam'; |
| 181 |
xa prepare 'rw_myisam';; |
| 182 |
disconnect master_rw_myisam; |
| 183 |
connection master; |
| 184 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 185 |
xa start 'rw_myisam'; |
| 186 |
insert into tm set a=1; |
| 187 |
xa end 'rw_myisam'; |
| 188 |
xa prepare 'rw_myisam';; |
| 189 |
disconnect master_rw_myisam; |
| 190 |
*** rw_myisam prepared must be in the list: |
| 191 |
connection master; |
| 192 |
xa recover; |
| 193 |
formatID gtrid_length bqual_length data |
| 194 |
1 9 0 rw_myisam |
| 195 |
*** Zero prepared xa:s must be in the list: |
| 196 |
xa recover; |
| 197 |
formatID gtrid_length bqual_length data |
| 198 |
*** At the end of MyISAM "xa" section gtid list has 7 more compare with previous check: |
| 199 |
flush logs; |
| 200 |
show binlog events in 'master-bin.000006' limit 1,1; |
| 201 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 202 |
master-bin.000006 # Gtid_list 1 # [0-1-25] |
| 203 |
connect master_$xid, 127.0.0.1,root,,$db,$MASTER_MYPORT,; |
| 204 |
set @@session.sql_log_bin = OFF; |
| 205 |
xa start 'skip_binlog'; |
| 206 |
insert into t2 values(1); |
| 207 |
xa end 'skip_binlog'; |
| 208 |
xa prepare 'skip_binlog'; |
| 209 |
disconnect master_skip_binlog; |
| 210 |
*** skip_binlog must be in the list: |
| 211 |
connection master; |
| 212 |
xa recover; |
| 213 |
formatID gtrid_length bqual_length data |
| 214 |
1 11 0 skip_binlog |
| 215 |
set @@session.sql_log_bin = OFF; |
| 216 |
xa rollback 'skip_binlog'; |
| 217 |
set @@session.sql_log_bin = ON; |
| 218 |
include/save_master_gtid.inc |
| 219 |
*** Zero must be in the list: |
| 220 |
connection master; |
| 221 |
xa recover; |
| 222 |
formatID gtrid_length bqual_length data |
| 223 |
*** At the end of skip_log_binb section gtid list has 0 more: |
| 224 |
flush logs; |
| 225 |
show binlog events in 'master-bin.000007' limit 1,1; |
| 226 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 227 |
master-bin.000007 # Gtid_list 1 # [0-1-25] |
| 228 |
connection slave; |
| 229 |
include/sync_with_master_gtid.inc |
| 230 |
connection master; |
| 231 |
drop database test_ign; |
| 232 |
drop table t1, t2, t3, tm; |
| 233 |
# |
| 234 |
# MDEV-26682 slave lock timeout with XA and gap locks |
| 235 |
# |
| 236 |
create table t1 (a int primary key, b int unique) engine=innodb; |
| 237 |
insert t1 values (1,1),(3,3),(5,5); |
| 238 |
connection slave; |
| 239 |
set session transaction_isolation='repeatable-read'; |
| 240 |
start transaction; |
| 241 |
select * from t1; |
| 242 |
a b |
| 243 |
1 1 |
| 244 |
3 3 |
| 245 |
5 5 |
| 246 |
connect m2, localhost, root; |
| 247 |
delete from t1 where a=3; |
| 248 |
xa start 'x1'; |
| 249 |
update t1 set b=3 where a=5; |
| 250 |
xa end 'x1'; |
| 251 |
xa prepare 'x1'; |
| 252 |
connect m3, localhost, root; |
| 253 |
insert t1 values (2, 2); |
| 254 |
-->slave |
| 255 |
connection slave; |
| 256 |
commit; |
| 257 |
select * from t1; |
| 258 |
a b |
| 259 |
1 1 |
| 260 |
2 2 |
| 261 |
5 5 |
| 262 |
connection m2; |
| 263 |
xa rollback 'x1'; |
| 264 |
disconnect m2; |
| 265 |
disconnect m3; |
| 266 |
connection master; |
| 267 |
drop table t1; |
| 268 |
create table t1 (id int auto_increment primary key, c1 int not null unique) |
| 269 |
engine=innodb; |
| 270 |
create table t2 (id int auto_increment primary key, c1 int not null, |
| 271 |
foreign key(c1) references t1(c1), unique key(c1)) engine=innodb; |
| 272 |
insert t1 values (869,1), (871,3), (873,4), (872,5), (870,6), (877,7); |
| 273 |
insert t2 values (795,6), (800,7); |
| 274 |
xa start '1'; |
| 275 |
update t2 set id = 9, c1 = 5 where c1 in (null, null, null, null, null, 7, 3); |
| 276 |
connect con1, localhost,root; |
| 277 |
xa start '2'; |
| 278 |
delete from t1 where c1 like '3%'; |
| 279 |
xa end '2'; |
| 280 |
xa prepare '2'; |
| 281 |
connection master; |
| 282 |
xa end '1'; |
| 283 |
xa prepare '1'; |
| 284 |
->slave |
| 285 |
connection slave; |
| 286 |
connection slave; |
| 287 |
include/sync_with_master_gtid.inc |
| 288 |
connection con1; |
| 289 |
xa commit '2'; |
| 290 |
disconnect con1; |
| 291 |
connection master; |
| 292 |
xa commit '1'; |
| 293 |
drop table t2, t1; |
| 294 |
connection slave; |
| 295 |
include/stop_slave.inc |
| 296 |
SET @@global.gtid_pos_auto_engines=""; |
| 297 |
SET @@session.sql_log_bin=0; |
| 298 |
DROP TABLE mysql.gtid_slave_pos_InnoDB; |
| 299 |
SET @@session.sql_log_bin=1; |
| 300 |
include/start_slave.inc |
| 301 |
include/rpl_end.inc |