| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source include/have_log_bin.inc |
| 3 |
|
| 4 |
connect (server1,127.0.0.1,root,,test,$MYSQLD1_PORT,); |
| 5 |
connect (server2,127.0.0.1,root,,test,$MYSQLD2_PORT,); |
| 6 |
connect (server3,127.0.0.1,root,,test,$MYSQLD3_PORT,); |
| 7 |
connect (server4,127.0.0.1,root,,test,$MYSQLD4_PORT,); |
| 8 |
|
| 9 |
connection server1; |
| 10 |
show variables like 'log_bin'; |
| 11 |
|
| 12 |
connection server2; |
| 13 |
show variables like 'log_bin'; |
| 14 |
|
| 15 |
connection server3; |
| 16 |
show variables like 'log_bin'; |
| 17 |
# Since this server is intentionally running without log-bin, supress warning |
| 18 |
--disable_query_log |
| 19 |
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work"); |
| 20 |
--enable_query_log |
| 21 |
|
| 22 |
connection server4; |
| 23 |
show variables like 'log_bin'; |
| 24 |
# Since this server is intentionally running without log-bin, supress warning |
| 25 |
-- disable_query_log |
| 26 |
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work"); |
| 27 |
-- enable_query_log |
| 28 |
|
| 29 |
# |
| 30 |
# Basic create+drop (from with and without log-bin) |
| 31 |
# no share should be present |
| 32 |
# |
| 33 |
connection server1; |
| 34 |
create table t1 (a int) engine=ndbcluster; |
| 35 |
drop table t1; |
| 36 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 37 |
|
| 38 |
connection server3; |
| 39 |
create table t1 (a int) engine=ndbcluster; |
| 40 |
drop table t1; |
| 41 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 42 |
|
| 43 |
# |
| 44 |
# Basic create+rename+drop (from with and without log-bin) |
| 45 |
# no share should be present |
| 46 |
# |
| 47 |
connection server1; |
| 48 |
create table t1 (a int) engine=ndbcluster; |
| 49 |
rename table t1 to t2; |
| 50 |
drop table t2; |
| 51 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 52 |
|
| 53 |
connection server2; |
| 54 |
create table t1 (a int) engine=ndbcluster; |
| 55 |
rename table t1 to t2; |
| 56 |
drop table t2; |
| 57 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 58 |
|
| 59 |
# |
| 60 |
# Basic create+offline-alter+drop (from with and without log-bin) |
| 61 |
# no share should be present |
| 62 |
# |
| 63 |
connection server1; |
| 64 |
create table t1 (a int) engine=ndbcluster; |
| 65 |
alter table t1 algorithm=copy, add column b int default 77; |
| 66 |
drop table t1; |
| 67 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 68 |
|
| 69 |
connection server2; |
| 70 |
create table t1 (a int) engine=ndbcluster; |
| 71 |
alter table t1 algorithm=copy, add column b int default 77; |
| 72 |
drop table t1; |
| 73 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 74 |
|
| 75 |
# |
| 76 |
# Basic create+offline-alter-partitions+drop (from with and without log-bin) |
| 77 |
# no share should be present |
| 78 |
# |
| 79 |
connection server1; |
| 80 |
create table t1 (a int primary key) engine=ndbcluster |
| 81 |
partition by list(a) (partition p0 values in (0)); |
| 82 |
alter table t1 algorithm=copy, add partition (partition p1 values in (1)); |
| 83 |
drop table t1; |
| 84 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 85 |
|
| 86 |
connection server2; |
| 87 |
create table t1 (a int primary key) engine=ndbcluster |
| 88 |
partition by list(a) (partition p0 values in (0)); |
| 89 |
alter table t1 algorithm=copy, add partition (partition p1 values in (1)); |
| 90 |
drop table t1; |
| 91 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 92 |
|
| 93 |
# |
| 94 |
# Basic create+online-alter+drop (from with and without log-bin) |
| 95 |
# no share should be present |
| 96 |
# |
| 97 |
connection server1; |
| 98 |
create table t1 (a int primary key) engine=ndbcluster; |
| 99 |
alter table t1 algorithm=inplace, add column b int column_format dynamic; |
| 100 |
drop table t1; |
| 101 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 102 |
|
| 103 |
connection server2; |
| 104 |
create table t1 (a int primary key) engine=ndbcluster; |
| 105 |
alter table t1 algorithm=copy, add column b int column_format dynamic; |
| 106 |
drop table t1; |
| 107 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 108 |
|
| 109 |
# |
| 110 |
# Basic create+multi-rename+drop (from with and without log-bin) |
| 111 |
# no share should be present |
| 112 |
# |
| 113 |
connection server1; |
| 114 |
create table t1 (a int) engine=ndbcluster; |
| 115 |
create table t2 (a int) engine=ndbcluster; |
| 116 |
rename table t1 to tmp, t2 to t1, tmp to t2; |
| 117 |
drop table t1, t2; |
| 118 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 119 |
|
| 120 |
connection server2; |
| 121 |
create table t1 (a int) engine=ndbcluster; |
| 122 |
create table t2 (a int) engine=ndbcluster; |
| 123 |
rename table t1 to tmp, t2 to t1, tmp to t2; |
| 124 |
drop table t1, t2; |
| 125 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 126 |
|
| 127 |
# |
| 128 |
# Now...lets get nastier 1 |
| 129 |
# create innodb tables on other servers...and then create ndb table |
| 130 |
# |
| 131 |
connection server2; |
| 132 |
create table t1 (a int) engine=innodb; |
| 133 |
|
| 134 |
# Suppress errors provoked by the "shadow table" on first mysqld |
| 135 |
--disable_query_log |
| 136 |
call mtr.add_suppression("Local table 'test.t1' .* shadows"); |
| 137 |
call mtr.add_suppression("Failed to remove table definition"); |
| 138 |
call mtr.add_suppression("Failed to update table definition"); |
| 139 |
call mtr.add_suppression("Failed to rename table definition"); |
| 140 |
call mtr.add_suppression("Distribution of CREATE TABLE"); |
| 141 |
call mtr.add_suppression("Distribution of ALTER TABLE"); |
| 142 |
--enable_query_log |
| 143 |
|
| 144 |
connection server4; |
| 145 |
create table t1 (a int) engine=innodb; |
| 146 |
|
| 147 |
# Suppress errors provoked by the "shadow table" on first mysqld |
| 148 |
--disable_query_log |
| 149 |
call mtr.add_suppression("Local table 'test.t1' .* shadows"); |
| 150 |
call mtr.add_suppression("Failed to remove table definition"); |
| 151 |
call mtr.add_suppression("Failed to update table definition"); |
| 152 |
call mtr.add_suppression("Failed to rename table definition"); |
| 153 |
call mtr.add_suppression("Distribution of CREATE TABLE"); |
| 154 |
call mtr.add_suppression("Distribution of ALTER TABLE"); |
| 155 |
--enable_query_log |
| 156 |
|
| 157 |
connection server1; |
| 158 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 159 |
create table t1 (a int) engine = ndb; |
| 160 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 161 |
drop table t1; |
| 162 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 163 |
|
| 164 |
connection server3; |
| 165 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 166 |
create table t1 (a int) engine = ndb; |
| 167 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 168 |
drop table t1; |
| 169 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 170 |
|
| 171 |
connection server1; |
| 172 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 173 |
create table t1 (a int) engine = ndb; |
| 174 |
|
| 175 |
connection server2; |
| 176 |
drop table t1; |
| 177 |
select * from t1 /* force discovery */; |
| 178 |
|
| 179 |
connection server4; |
| 180 |
drop table t1; |
| 181 |
select * from t1 /* force discovery */; |
| 182 |
|
| 183 |
connection server1; |
| 184 |
drop table t1; |
| 185 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 186 |
|
| 187 |
# |
| 188 |
# Now...lets get nastier 2 |
| 189 |
# create innodb tables on other servers...and then create ndb table |
| 190 |
# and off-line alter them |
| 191 |
connection server2; |
| 192 |
create table t1 (a int) engine=innodb; |
| 193 |
connection server4; |
| 194 |
create table t1 (a int) engine=innodb; |
| 195 |
|
| 196 |
connection server1; |
| 197 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 198 |
create table t1 (a int) engine = ndb; |
| 199 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 200 |
alter table t1 algorithm=copy, add column b int column_format dynamic; |
| 201 |
|
| 202 |
connection server2; |
| 203 |
drop table t1; |
| 204 |
select * from t1 /* force discovery */; |
| 205 |
|
| 206 |
connection server4; |
| 207 |
drop table t1; |
| 208 |
select * from t1 /* force discovery */; |
| 209 |
|
| 210 |
connection server1; |
| 211 |
drop table t1; |
| 212 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 213 |
|
| 214 |
# |
| 215 |
# Now...lets get nastier 3 |
| 216 |
# create innodb tables on other servers...and then create ndb table |
| 217 |
# and online alter them |
| 218 |
connection server2; |
| 219 |
create table t1 (a int) engine=innodb; |
| 220 |
connection server4; |
| 221 |
create table t1 (a int) engine=innodb; |
| 222 |
|
| 223 |
connection server1; |
| 224 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 225 |
create table t1 (a int primary key) engine = ndb; |
| 226 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 227 |
alter table t1 algorithm=inplace, add column b int column_format dynamic; |
| 228 |
|
| 229 |
connection server2; |
| 230 |
drop table t1; |
| 231 |
select * from t1 /* force discovery */; |
| 232 |
|
| 233 |
connection server4; |
| 234 |
drop table t1; |
| 235 |
select * from t1 /* force discovery */; |
| 236 |
|
| 237 |
connection server1; |
| 238 |
drop table t1; |
| 239 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 240 |
|
| 241 |
# |
| 242 |
# Now...lets get nastier 4 |
| 243 |
# create innodb tables on other servers...and then create ndb table |
| 244 |
# and rename them |
| 245 |
connection server2; |
| 246 |
create table t1 (a int) engine=innodb; |
| 247 |
connection server4; |
| 248 |
create table t1 (a int) engine=innodb; |
| 249 |
|
| 250 |
connection server1; |
| 251 |
replace_regex /Node [0-9]+:/Node <nodeid>/; |
| 252 |
create table t1 (a int) engine = ndb; |
| 253 |
rename table t1 to t2; |
| 254 |
|
| 255 |
connection server2; |
| 256 |
select * from t2 /* force discovery */; |
| 257 |
|
| 258 |
connection server4; |
| 259 |
select * from t2 /* force discovery */; |
| 260 |
|
| 261 |
connection server1; |
| 262 |
drop table t2; |
| 263 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 264 |
|
| 265 |
connection server2; |
| 266 |
drop table t1; |
| 267 |
|
| 268 |
connection server4; |
| 269 |
drop table t1; |
| 270 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 271 |
|
| 272 |
# |
| 273 |
# Now...create table if not exists |
| 274 |
# |
| 275 |
--disable_warnings |
| 276 |
let $1=5; |
| 277 |
while ($1) |
| 278 |
{ |
| 279 |
dec $1; |
| 280 |
connection server1; |
| 281 |
--send create table if not exists t1 (a int) engine=ndbcluster |
| 282 |
connection server2; |
| 283 |
--send create table if not exists t1 (a int) engine=ndbcluster |
| 284 |
connection server3; |
| 285 |
--send create table if not exists t1 (a int) engine=ndbcluster |
| 286 |
connection server4; |
| 287 |
--send create table if not exists t1 (a int) engine=ndbcluster |
| 288 |
connection server1; |
| 289 |
--reap |
| 290 |
connection server2; |
| 291 |
--reap |
| 292 |
connection server3; |
| 293 |
--reap |
| 294 |
connection server4; |
| 295 |
--reap |
| 296 |
connection server1; |
| 297 |
drop table t1; |
| 298 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 299 |
} |
| 300 |
--enable_warnings |
| 301 |
|
| 302 |
# |
| 303 |
# Now...drop table if exists |
| 304 |
# |
| 305 |
--disable_warnings |
| 306 |
let $1=5; |
| 307 |
while ($1) |
| 308 |
{ |
| 309 |
dec $1; |
| 310 |
connection server1; |
| 311 |
create table t1 (a int) engine=ndbcluster; |
| 312 |
|
| 313 |
connection server1; |
| 314 |
--send drop table if exists t1 |
| 315 |
connection server2; |
| 316 |
--send drop table if exists t1 |
| 317 |
connection server3; |
| 318 |
--send drop table if exists t1 |
| 319 |
connection server4; |
| 320 |
--send drop table if exists t1 |
| 321 |
connection server1; |
| 322 |
--reap |
| 323 |
connection server2; |
| 324 |
--reap |
| 325 |
connection server3; |
| 326 |
--reap |
| 327 |
connection server4; |
| 328 |
--reap |
| 329 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 330 |
} |
| 331 |
--enable_warnings |
| 332 |
|
| 333 |
# |
| 334 |
# Now...restart |
| 335 |
# |
| 336 |
connection server1; |
| 337 |
create table t1 (a int) engine=ndbcluster; |
| 338 |
|
| 339 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 340 |
# when cluster is restarted |
| 341 |
--disable_query_log ONCE |
| 342 |
call mtr.add_suppression("cluster disconnect An incident event has been written"); |
| 343 |
|
| 344 |
connection server2; |
| 345 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 346 |
# when cluster is restarted |
| 347 |
--disable_query_log ONCE |
| 348 |
call mtr.add_suppression("cluster disconnect An incident event has been written"); |
| 349 |
|
| 350 |
connection server3; |
| 351 |
create table t2 (a int) engine=ndbcluster; |
| 352 |
|
| 353 |
--exec $NDB_MGM -e "all restart -n" >> $NDB_TOOLS_OUTPUT |
| 354 |
--exec $NDB_WAITER --not-started |
| 355 |
--exec $NDB_MGM -e "all start" >> $NDB_TOOLS_OUTPUT |
| 356 |
--exec $NDB_WAITER |
| 357 |
|
| 358 |
# Wait for mysqld(s) to reconnect and exit from readonly mode |
| 359 |
connection server1; |
| 360 |
--source include/ndb_not_readonly.inc |
| 361 |
connection server2; |
| 362 |
--source include/ndb_not_readonly.inc |
| 363 |
connection server3; |
| 364 |
--source include/ndb_not_readonly.inc |
| 365 |
connection server4; |
| 366 |
--source include/ndb_not_readonly.inc |
| 367 |
|
| 368 |
connection server1; |
| 369 |
select * from t1 /* force discovery */; |
| 370 |
select * from t2 /* force discovery */; |
| 371 |
connection server2; |
| 372 |
select * from t1 /* force discovery */; |
| 373 |
select * from t2 /* force discovery */; |
| 374 |
connection server3; |
| 375 |
select * from t1 /* force discovery */; |
| 376 |
select * from t2 /* force discovery */; |
| 377 |
connection server4; |
| 378 |
select * from t1 /* force discovery */; |
| 379 |
select * from t2 /* force discovery */; |
| 380 |
|
| 381 |
connection server1; |
| 382 |
drop table t1, t2; |
| 383 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 384 |
|
| 385 |
# |
| 386 |
# Now...restart -i |
| 387 |
# |
| 388 |
connection server1; |
| 389 |
create table t1 (a int) engine=ndbcluster; |
| 390 |
|
| 391 |
connection server3; |
| 392 |
create table t2 (a int) engine=ndbcluster; |
| 393 |
|
| 394 |
--exec $NDB_MGM -e "all restart -i -n" >> $NDB_TOOLS_OUTPUT |
| 395 |
--exec $NDB_WAITER --not-started |
| 396 |
--exec $NDB_MGM -e "all start" >> $NDB_TOOLS_OUTPUT |
| 397 |
--exec $NDB_WAITER |
| 398 |
|
| 399 |
# Wait for mysqld(s) to reconnect and exit from readonly mode |
| 400 |
connection server1; |
| 401 |
--source include/ndb_not_readonly.inc |
| 402 |
connection server2; |
| 403 |
--source include/ndb_not_readonly.inc |
| 404 |
connection server3; |
| 405 |
--source include/ndb_not_readonly.inc |
| 406 |
connection server4; |
| 407 |
--source include/ndb_not_readonly.inc |
| 408 |
|
| 409 |
connection server1; |
| 410 |
--error ER_NO_SUCH_TABLE |
| 411 |
select * from t1 /* force discovery */; |
| 412 |
--error ER_NO_SUCH_TABLE |
| 413 |
select * from t2 /* force discovery */; |
| 414 |
connection server2; |
| 415 |
--error ER_NO_SUCH_TABLE |
| 416 |
select * from t1 /* force discovery */; |
| 417 |
--error ER_NO_SUCH_TABLE |
| 418 |
select * from t2 /* force discovery */; |
| 419 |
connection server3; |
| 420 |
--error ER_NO_SUCH_TABLE |
| 421 |
select * from t1 /* force discovery */; |
| 422 |
--error ER_NO_SUCH_TABLE |
| 423 |
select * from t2 /* force discovery */; |
| 424 |
connection server4; |
| 425 |
--error ER_NO_SUCH_TABLE |
| 426 |
select * from t1 /* force discovery */; |
| 427 |
--error ER_NO_SUCH_TABLE |
| 428 |
select * from t2 /* force discovery */; |
| 429 |
|
| 430 |
--source suite/ndb/include/ndb_share_check_shares.inc |
| 431 |
--remove_file $NDB_TOOLS_OUTPUT |