| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection master; |
| 4 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 5 |
set global binlog_alter_two_phase = ON; |
| 6 |
set binlog_alter_two_phase = ON; |
| 7 |
connection slave; |
| 8 |
set global gtid_strict_mode=1; |
| 9 |
# Legacy Master Slave |
| 10 |
connect master_node,127.0.0.1,root,,$db_name, $M_port; |
| 11 |
connect slave_node,127.0.0.1,root,,test, $S_port; |
| 12 |
# myisam |
| 13 |
connection master_node; |
| 14 |
create table t1(a int, b int) engine=myisam;; |
| 15 |
insert into t1 values(1,1); |
| 16 |
insert into t1 values(2,2); |
| 17 |
# Normal Alter |
| 18 |
alter table t1 add column c int; |
| 19 |
show create table t1; |
| 20 |
Table Create Table |
| 21 |
t1 CREATE TABLE `t1` ( |
| 22 |
`a` int(11) DEFAULT NULL, |
| 23 |
`b` int(11) DEFAULT NULL, |
| 24 |
`c` int(11) DEFAULT NULL |
| 25 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 26 |
# Failed Alter |
| 27 |
insert into t1 values(1,1, NULL); |
| 28 |
alter table t1 change a a int unique; |
| 29 |
ERROR 23000: Duplicate entry '1' for key 'a' |
| 30 |
set @@session.binlog_alter_two_phase = 0; |
| 31 |
alter table t1 change a a int; |
| 32 |
set @@session.binlog_alter_two_phase = 1; |
| 33 |
alter table t1 change a a int; |
| 34 |
show create table t1; |
| 35 |
Table Create Table |
| 36 |
t1 CREATE TABLE `t1` ( |
| 37 |
`a` int(11) DEFAULT NULL, |
| 38 |
`b` int(11) DEFAULT NULL, |
| 39 |
`c` int(11) DEFAULT NULL |
| 40 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 41 |
include/save_master_gtid.inc |
| 42 |
connection slave_node; |
| 43 |
include/sync_with_master_gtid.inc |
| 44 |
show create table t1; |
| 45 |
Table Create Table |
| 46 |
t1 CREATE TABLE `t1` ( |
| 47 |
`a` int(11) DEFAULT NULL, |
| 48 |
`b` int(11) DEFAULT NULL, |
| 49 |
`c` int(11) DEFAULT NULL |
| 50 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 51 |
connection master_node; |
| 52 |
drop table t1; |
| 53 |
include/save_master_gtid.inc |
| 54 |
connection slave_node; |
| 55 |
include/sync_with_master_gtid.inc |
| 56 |
# innodb |
| 57 |
connection master_node; |
| 58 |
create table t1(a int, b int) engine=innodb;; |
| 59 |
insert into t1 values(1,1); |
| 60 |
insert into t1 values(2,2); |
| 61 |
# Normal Alter |
| 62 |
alter table t1 add column c int; |
| 63 |
show create table t1; |
| 64 |
Table Create Table |
| 65 |
t1 CREATE TABLE `t1` ( |
| 66 |
`a` int(11) DEFAULT NULL, |
| 67 |
`b` int(11) DEFAULT NULL, |
| 68 |
`c` int(11) DEFAULT NULL |
| 69 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 70 |
# Failed Alter |
| 71 |
insert into t1 values(1,1, NULL); |
| 72 |
alter table t1 change a a int unique; |
| 73 |
ERROR 23000: Duplicate entry '1' for key 'a' |
| 74 |
set @@session.binlog_alter_two_phase = 0; |
| 75 |
alter table t1 change a a int; |
| 76 |
set @@session.binlog_alter_two_phase = 1; |
| 77 |
alter table t1 change a a int; |
| 78 |
show create table t1; |
| 79 |
Table Create Table |
| 80 |
t1 CREATE TABLE `t1` ( |
| 81 |
`a` int(11) DEFAULT NULL, |
| 82 |
`b` int(11) DEFAULT NULL, |
| 83 |
`c` int(11) DEFAULT NULL |
| 84 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 85 |
include/save_master_gtid.inc |
| 86 |
connection slave_node; |
| 87 |
include/sync_with_master_gtid.inc |
| 88 |
show create table t1; |
| 89 |
Table Create Table |
| 90 |
t1 CREATE TABLE `t1` ( |
| 91 |
`a` int(11) DEFAULT NULL, |
| 92 |
`b` int(11) DEFAULT NULL, |
| 93 |
`c` int(11) DEFAULT NULL |
| 94 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 95 |
connection master_node; |
| 96 |
drop table t1; |
| 97 |
include/save_master_gtid.inc |
| 98 |
connection slave_node; |
| 99 |
include/sync_with_master_gtid.inc |
| 100 |
# aria |
| 101 |
connection master_node; |
| 102 |
create table t1(a int, b int) engine=aria;; |
| 103 |
insert into t1 values(1,1); |
| 104 |
insert into t1 values(2,2); |
| 105 |
# Normal Alter |
| 106 |
alter table t1 add column c int; |
| 107 |
show create table t1; |
| 108 |
Table Create Table |
| 109 |
t1 CREATE TABLE `t1` ( |
| 110 |
`a` int(11) DEFAULT NULL, |
| 111 |
`b` int(11) DEFAULT NULL, |
| 112 |
`c` int(11) DEFAULT NULL |
| 113 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1 |
| 114 |
# Failed Alter |
| 115 |
insert into t1 values(1,1, NULL); |
| 116 |
alter table t1 change a a int unique; |
| 117 |
ERROR 23000: Duplicate entry '1' for key 'a' |
| 118 |
set @@session.binlog_alter_two_phase = 0; |
| 119 |
alter table t1 change a a int; |
| 120 |
set @@session.binlog_alter_two_phase = 1; |
| 121 |
alter table t1 change a a int; |
| 122 |
show create table t1; |
| 123 |
Table Create Table |
| 124 |
t1 CREATE TABLE `t1` ( |
| 125 |
`a` int(11) DEFAULT NULL, |
| 126 |
`b` int(11) DEFAULT NULL, |
| 127 |
`c` int(11) DEFAULT NULL |
| 128 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1 |
| 129 |
include/save_master_gtid.inc |
| 130 |
connection slave_node; |
| 131 |
include/sync_with_master_gtid.inc |
| 132 |
show create table t1; |
| 133 |
Table Create Table |
| 134 |
t1 CREATE TABLE `t1` ( |
| 135 |
`a` int(11) DEFAULT NULL, |
| 136 |
`b` int(11) DEFAULT NULL, |
| 137 |
`c` int(11) DEFAULT NULL |
| 138 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1 |
| 139 |
connection master_node; |
| 140 |
drop table t1; |
| 141 |
include/save_master_gtid.inc |
| 142 |
connection slave_node; |
| 143 |
include/sync_with_master_gtid.inc |
| 144 |
# concurrent alter Myisam |
| 145 |
# Sync slave |
| 146 |
include/save_master_gtid.inc |
| 147 |
include/sync_with_master_gtid.inc |
| 148 |
# Sync slave |
| 149 |
include/save_master_gtid.inc |
| 150 |
include/sync_with_master_gtid.inc |
| 151 |
# Concurrent DML |
| 152 |
# Sync slave |
| 153 |
include/save_master_gtid.inc |
| 154 |
include/sync_with_master_gtid.inc |
| 155 |
# Rollback tests |
| 156 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 157 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 158 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 159 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 160 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 161 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 162 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 163 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 164 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 165 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 166 |
# Sync slave |
| 167 |
include/save_master_gtid.inc |
| 168 |
include/sync_with_master_gtid.inc |
| 169 |
# diff_table of master and slave , we will do only in the case when |
| 170 |
# sync_slave is on |
| 171 |
include/diff_tables.inc [master_node:t1, slave_node:t1] |
| 172 |
include/diff_tables.inc [master_node:t2, slave_node:t2] |
| 173 |
include/diff_tables.inc [master_node:t3, slave_node:t3] |
| 174 |
include/diff_tables.inc [master_node:t4, slave_node:t4] |
| 175 |
include/diff_tables.inc [master_node:t5, slave_node:t5] |
| 176 |
include/diff_tables.inc [master_node:t6, slave_node:t6] |
| 177 |
include/diff_tables.inc [master_node:t7, slave_node:t7] |
| 178 |
include/diff_tables.inc [master_node:t8, slave_node:t8] |
| 179 |
include/diff_tables.inc [master_node:t9, slave_node:t9] |
| 180 |
include/diff_tables.inc [master_node:t10, slave_node:t10] |
| 181 |
# Sync slave |
| 182 |
include/save_master_gtid.inc |
| 183 |
include/sync_with_master_gtid.inc |
| 184 |
# concurrent alter Aria |
| 185 |
# Sync slave |
| 186 |
include/save_master_gtid.inc |
| 187 |
include/sync_with_master_gtid.inc |
| 188 |
# Sync slave |
| 189 |
include/save_master_gtid.inc |
| 190 |
include/sync_with_master_gtid.inc |
| 191 |
# Concurrent DML |
| 192 |
# Sync slave |
| 193 |
include/save_master_gtid.inc |
| 194 |
include/sync_with_master_gtid.inc |
| 195 |
# Rollback tests |
| 196 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 197 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 198 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 199 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 200 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 201 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 202 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 203 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 204 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 205 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 206 |
# Sync slave |
| 207 |
include/save_master_gtid.inc |
| 208 |
include/sync_with_master_gtid.inc |
| 209 |
# diff_table of master and slave , we will do only in the case when |
| 210 |
# sync_slave is on |
| 211 |
include/diff_tables.inc [master_node:t1, slave_node:t1] |
| 212 |
include/diff_tables.inc [master_node:t2, slave_node:t2] |
| 213 |
include/diff_tables.inc [master_node:t3, slave_node:t3] |
| 214 |
include/diff_tables.inc [master_node:t4, slave_node:t4] |
| 215 |
include/diff_tables.inc [master_node:t5, slave_node:t5] |
| 216 |
include/diff_tables.inc [master_node:t6, slave_node:t6] |
| 217 |
include/diff_tables.inc [master_node:t7, slave_node:t7] |
| 218 |
include/diff_tables.inc [master_node:t8, slave_node:t8] |
| 219 |
include/diff_tables.inc [master_node:t9, slave_node:t9] |
| 220 |
include/diff_tables.inc [master_node:t10, slave_node:t10] |
| 221 |
# Sync slave |
| 222 |
include/save_master_gtid.inc |
| 223 |
include/sync_with_master_gtid.inc |
| 224 |
# concurrent alter Innodb copy |
| 225 |
# Sync slave |
| 226 |
include/save_master_gtid.inc |
| 227 |
include/sync_with_master_gtid.inc |
| 228 |
# Sync slave |
| 229 |
include/save_master_gtid.inc |
| 230 |
include/sync_with_master_gtid.inc |
| 231 |
# Concurrent DML |
| 232 |
# Sync slave |
| 233 |
include/save_master_gtid.inc |
| 234 |
include/sync_with_master_gtid.inc |
| 235 |
# Rollback tests |
| 236 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 237 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 238 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 239 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 240 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 241 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 242 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 243 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 244 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 245 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 246 |
# Sync slave |
| 247 |
include/save_master_gtid.inc |
| 248 |
include/sync_with_master_gtid.inc |
| 249 |
# diff_table of master and slave , we will do only in the case when |
| 250 |
# sync_slave is on |
| 251 |
include/diff_tables.inc [master_node:t1, slave_node:t1] |
| 252 |
include/diff_tables.inc [master_node:t2, slave_node:t2] |
| 253 |
include/diff_tables.inc [master_node:t3, slave_node:t3] |
| 254 |
include/diff_tables.inc [master_node:t4, slave_node:t4] |
| 255 |
include/diff_tables.inc [master_node:t5, slave_node:t5] |
| 256 |
include/diff_tables.inc [master_node:t6, slave_node:t6] |
| 257 |
include/diff_tables.inc [master_node:t7, slave_node:t7] |
| 258 |
include/diff_tables.inc [master_node:t8, slave_node:t8] |
| 259 |
include/diff_tables.inc [master_node:t9, slave_node:t9] |
| 260 |
include/diff_tables.inc [master_node:t10, slave_node:t10] |
| 261 |
# Sync slave |
| 262 |
include/save_master_gtid.inc |
| 263 |
include/sync_with_master_gtid.inc |
| 264 |
# concurrent alter Innodb Inplace |
| 265 |
# Sync slave |
| 266 |
include/save_master_gtid.inc |
| 267 |
include/sync_with_master_gtid.inc |
| 268 |
# Sync slave |
| 269 |
include/save_master_gtid.inc |
| 270 |
include/sync_with_master_gtid.inc |
| 271 |
# Concurrent DML |
| 272 |
# Sync slave |
| 273 |
include/save_master_gtid.inc |
| 274 |
include/sync_with_master_gtid.inc |
| 275 |
# Sync slave |
| 276 |
include/save_master_gtid.inc |
| 277 |
include/sync_with_master_gtid.inc |
| 278 |
# Rollback tests |
| 279 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 280 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 281 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 282 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 283 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 284 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 285 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 286 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 287 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 288 |
ERROR 23000: Duplicate entry '2' for key 'b' |
| 289 |
# Sync slave |
| 290 |
include/save_master_gtid.inc |
| 291 |
include/sync_with_master_gtid.inc |
| 292 |
# diff_table of master and slave , we will do only in the case when |
| 293 |
# sync_slave is on |
| 294 |
include/diff_tables.inc [master_node:t1, slave_node:t1] |
| 295 |
include/diff_tables.inc [master_node:t2, slave_node:t2] |
| 296 |
include/diff_tables.inc [master_node:t3, slave_node:t3] |
| 297 |
include/diff_tables.inc [master_node:t4, slave_node:t4] |
| 298 |
include/diff_tables.inc [master_node:t5, slave_node:t5] |
| 299 |
include/diff_tables.inc [master_node:t6, slave_node:t6] |
| 300 |
include/diff_tables.inc [master_node:t7, slave_node:t7] |
| 301 |
include/diff_tables.inc [master_node:t8, slave_node:t8] |
| 302 |
include/diff_tables.inc [master_node:t9, slave_node:t9] |
| 303 |
include/diff_tables.inc [master_node:t10, slave_node:t10] |
| 304 |
# Sync slave |
| 305 |
include/save_master_gtid.inc |
| 306 |
include/sync_with_master_gtid.inc |
| 307 |
connection master; |
| 308 |
include/save_master_gtid.inc |
| 309 |
connection slave; |
| 310 |
include/sync_with_master_gtid.inc |
| 311 |
set global gtid_strict_mode = 0;; |
| 312 |
connection master; |
| 313 |
set global binlog_alter_two_phase=0;; |
| 314 |
include/rpl_end.inc |