| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/have_binlog_format_mixed_or_row.inc |
| 3 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 4 |
|
| 5 |
--connection slave |
| 6 |
show variables like 'replica_allow_batching'; |
| 7 |
# Use large batch sizes on slave |
| 8 |
set @s_batch_size:=@@ndb_batch_size; |
| 9 |
set @s_blob_write_batch:=@@ndb_blob_write_batch_bytes; |
| 10 |
set @s_blob_read_batch:=@@ndb_blob_read_batch_bytes; |
| 11 |
|
| 12 |
set @batch_sz = 8 * 1024 * 1024; |
| 13 |
set global ndb_batch_size = @batch_sz; |
| 14 |
set ndb_batch_size = @batch_sz; |
| 15 |
set global ndb_blob_write_batch_bytes = @batch_sz; |
| 16 |
set ndb_blob_write_batch_bytes = @batch_sz; |
| 17 |
set global ndb_blob_read_batch_bytes = @batch_sz; |
| 18 |
set ndb_blob_read_batch_bytes = @batch_sz; |
| 19 |
|
| 20 |
--connection master |
| 21 |
show variables like 'ndb_log_update_as_write'; |
| 22 |
|
| 23 |
--vertical_results |
| 24 |
--disable_query_log |
| 25 |
--disable_result_log |
| 26 |
|
| 27 |
create table tsync (a int primary key) engine=ndb; |
| 28 |
|
| 29 |
create table tv (a int primary key, b varbinary(10000)) engine=ndb; |
| 30 |
create table tb1 (a int primary key, b blob) engine=ndb; |
| 31 |
create table tb2 (a int primary key, b blob, c blob) engine=ndb; |
| 32 |
|
| 33 |
insert into tsync values (1); |
| 34 |
|
| 35 |
--sync_slave_with_master |
| 36 |
--connection slave |
| 37 |
|
| 38 |
let $_count_suffix=_slave; |
| 39 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 40 |
|
| 41 |
--connection master |
| 42 |
--echo |
| 43 |
--echo Bulk insert (20 x ~3kb) |
| 44 |
--echo ----------------------- |
| 45 |
|
| 46 |
--disable_query_log |
| 47 |
begin; |
| 48 |
insert into tv values |
| 49 |
(1, repeat('B', 3000)), |
| 50 |
(2, repeat('B', 3000)), |
| 51 |
(3, repeat('B', 3000)), |
| 52 |
(4, repeat('B', 3000)), |
| 53 |
(5, repeat('B', 3000)), |
| 54 |
(6, repeat('B', 3000)), |
| 55 |
(7, repeat('B', 3000)), |
| 56 |
(8, repeat('B', 3000)), |
| 57 |
(9, repeat('B', 3000)), |
| 58 |
(10, repeat('B', 3000)), |
| 59 |
(11, repeat('B', 3000)), |
| 60 |
(12, repeat('B', 3000)), |
| 61 |
(13, repeat('B', 3000)), |
| 62 |
(14, repeat('B', 3000)), |
| 63 |
(15, repeat('B', 3000)), |
| 64 |
(16, repeat('B', 3000)), |
| 65 |
(17, repeat('B', 3000)), |
| 66 |
(18, repeat('B', 3000)), |
| 67 |
(19, repeat('B', 3000)), |
| 68 |
(20, repeat('B', 3000)); |
| 69 |
commit; |
| 70 |
--enable_query_log |
| 71 |
|
| 72 |
--sync_slave_with_master |
| 73 |
--connection slave |
| 74 |
|
| 75 |
--echo Varchar table |
| 76 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 77 |
--echo |
| 78 |
|
| 79 |
--connection master |
| 80 |
--disable_query_log |
| 81 |
begin; |
| 82 |
insert into tb1 values |
| 83 |
(1, repeat('B', 3000)), |
| 84 |
(2, repeat('B', 3000)), |
| 85 |
(3, repeat('B', 3000)), |
| 86 |
(4, repeat('B', 3000)), |
| 87 |
(5, repeat('B', 3000)), |
| 88 |
(6, repeat('B', 3000)), |
| 89 |
(7, repeat('B', 3000)), |
| 90 |
(8, repeat('B', 3000)), |
| 91 |
(9, repeat('B', 3000)), |
| 92 |
(10, repeat('B', 3000)), |
| 93 |
(11, repeat('B', 3000)), |
| 94 |
(12, repeat('B', 3000)), |
| 95 |
(13, repeat('B', 3000)), |
| 96 |
(14, repeat('B', 3000)), |
| 97 |
(15, repeat('B', 3000)), |
| 98 |
(16, repeat('B', 3000)), |
| 99 |
(17, repeat('B', 3000)), |
| 100 |
(18, repeat('B', 3000)), |
| 101 |
(19, repeat('B', 3000)), |
| 102 |
(20, repeat('B', 3000)); |
| 103 |
commit; |
| 104 |
--enable_query_log |
| 105 |
|
| 106 |
--sync_slave_with_master |
| 107 |
--connection slave |
| 108 |
|
| 109 |
--echo 1 Blob table |
| 110 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 111 |
--echo |
| 112 |
|
| 113 |
--connection master |
| 114 |
--disable_query_log |
| 115 |
begin; |
| 116 |
insert into tb2 values |
| 117 |
(1, repeat('B', 3000), repeat('J', 3000)), |
| 118 |
(2, repeat('B', 3000), repeat('J', 3000)), |
| 119 |
(3, repeat('B', 3000), repeat('J', 3000)), |
| 120 |
(4, repeat('B', 3000), repeat('J', 3000)), |
| 121 |
(5, repeat('B', 3000), repeat('J', 3000)), |
| 122 |
(6, repeat('B', 3000), repeat('J', 3000)), |
| 123 |
(7, repeat('B', 3000), repeat('J', 3000)), |
| 124 |
(8, repeat('B', 3000), repeat('J', 3000)), |
| 125 |
(9, repeat('B', 3000), repeat('J', 3000)), |
| 126 |
(10, repeat('B', 3000), repeat('J', 3000)), |
| 127 |
(11, repeat('B', 3000), repeat('J', 3000)), |
| 128 |
(12, repeat('B', 3000), repeat('J', 3000)), |
| 129 |
(13, repeat('B', 3000), repeat('J', 3000)), |
| 130 |
(14, repeat('B', 3000), repeat('J', 3000)), |
| 131 |
(15, repeat('B', 3000), repeat('J', 3000)), |
| 132 |
(16, repeat('B', 3000), repeat('J', 3000)), |
| 133 |
(17, repeat('B', 3000), repeat('J', 3000)), |
| 134 |
(18, repeat('B', 3000), repeat('J', 3000)), |
| 135 |
(19, repeat('B', 3000), repeat('J', 3000)), |
| 136 |
(20, repeat('B', 3000), repeat('J', 3000)); |
| 137 |
commit; |
| 138 |
--enable_query_log |
| 139 |
|
| 140 |
--sync_slave_with_master |
| 141 |
--connection slave |
| 142 |
|
| 143 |
--echo 2 Blob table |
| 144 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 145 |
--echo |
| 146 |
|
| 147 |
--connection master |
| 148 |
--echo |
| 149 |
--echo Bulk update (20 x ~3kB) |
| 150 |
--echo --------------------------------- |
| 151 |
|
| 152 |
begin; |
| 153 |
update tv set b=repeat('J', 3000) where a in |
| 154 |
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); |
| 155 |
commit; |
| 156 |
|
| 157 |
--sync_slave_with_master |
| 158 |
--connection slave |
| 159 |
|
| 160 |
--echo Varchar table |
| 161 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 162 |
--echo |
| 163 |
|
| 164 |
--connection master |
| 165 |
begin; |
| 166 |
update tb1 set b=repeat('J', 3000) where a in |
| 167 |
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); |
| 168 |
commit; |
| 169 |
|
| 170 |
--sync_slave_with_master |
| 171 |
--connection slave |
| 172 |
|
| 173 |
--echo 1 Blob table |
| 174 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 175 |
--echo |
| 176 |
|
| 177 |
--connection master |
| 178 |
begin; |
| 179 |
update tb2 set b=repeat('J', 3000), c=repeat('C', 3000) where a in |
| 180 |
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); |
| 181 |
commit; |
| 182 |
|
| 183 |
--sync_slave_with_master |
| 184 |
--connection slave |
| 185 |
|
| 186 |
--echo 2 Blob table |
| 187 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 188 |
--echo |
| 189 |
|
| 190 |
--connection master |
| 191 |
--echo |
| 192 |
--echo Mixed batch (6 x ~3kB update, 5x ~1kB delete, 5x ~3kB insert all independent) |
| 193 |
--echo ----------------------------------------------------------------------------- |
| 194 |
--echo As all are independent, should get maximal batching |
| 195 |
|
| 196 |
begin; |
| 197 |
update tv set b=repeat('C', 3000) where a in (15,16,17,18,19,20); |
| 198 |
delete from tv where a in (1,2,3,4,5); |
| 199 |
insert into tv values (21, repeat('B', 3000)); |
| 200 |
insert into tv values (22, repeat('B', 3000)); |
| 201 |
insert into tv values (23, repeat('B', 3000)); |
| 202 |
insert into tv values (24, repeat('B', 3000)); |
| 203 |
insert into tv values (25, repeat('B', 3000)); |
| 204 |
commit; |
| 205 |
|
| 206 |
--sync_slave_with_master |
| 207 |
--connection slave |
| 208 |
|
| 209 |
--echo Varchar table |
| 210 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 211 |
--echo |
| 212 |
|
| 213 |
--connection master |
| 214 |
|
| 215 |
begin; |
| 216 |
update tb1 set b=repeat('C', 3000) where a in (15,16,17,18,19,20); |
| 217 |
delete from tb1 where a in (1,2,3,4,5); |
| 218 |
insert into tb1 values (21, repeat('B', 3000)); |
| 219 |
insert into tb1 values (22, repeat('B', 3000)); |
| 220 |
insert into tb1 values (23, repeat('B', 3000)); |
| 221 |
insert into tb1 values (24, repeat('B', 3000)); |
| 222 |
insert into tb1 values (25, repeat('B', 3000)); |
| 223 |
commit; |
| 224 |
|
| 225 |
--sync_slave_with_master |
| 226 |
--connection slave |
| 227 |
|
| 228 |
--echo 1 Blob table |
| 229 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 230 |
--echo |
| 231 |
|
| 232 |
--connection master |
| 233 |
|
| 234 |
begin; |
| 235 |
update tb2 set b=repeat('C', 3000), c=repeat('T', 4000) where a in (15,16,17,18,19,20); |
| 236 |
delete from tb2 where a in (1,2,3,4,5); |
| 237 |
insert into tb2 values (21, repeat('B', 3000), repeat('S', 4000)); |
| 238 |
insert into tb2 values (22, repeat('B', 3000), repeat('G', 3000)); |
| 239 |
insert into tb2 values (23, repeat('B', 3000), repeat('S', 4000)); |
| 240 |
insert into tb2 values (24, repeat('B', 3000), repeat('G', 3000)); |
| 241 |
insert into tb2 values (25, repeat('B', 3000), repeat('!', 4000)); |
| 242 |
commit; |
| 243 |
|
| 244 |
--sync_slave_with_master |
| 245 |
--connection slave |
| 246 |
|
| 247 |
--echo 2 Blob table |
| 248 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 249 |
--echo |
| 250 |
|
| 251 |
--connection master |
| 252 |
--echo |
| 253 |
--echo Mixed batch multiple tables |
| 254 |
--echo (6 x ~3kB update, 5x ~1kB delete, 5x ~3kB insert all independent) |
| 255 |
--echo ----------------------------------------------------------------------------- |
| 256 |
--echo As all are independent, should get maximal batching |
| 257 |
--echo Same keys used in different tables, should not impact batching |
| 258 |
|
| 259 |
begin; |
| 260 |
update tv set b=repeat('B', 3000) where a in (15,16,17,18,19,20); |
| 261 |
delete from tv where a in (21,22,23,24,25); |
| 262 |
insert into tv values (1, repeat('D', 4000)); |
| 263 |
insert into tv values (2, repeat('N', 4000)); |
| 264 |
insert into tv values (3, repeat('B', 3000)); |
| 265 |
insert into tv values (4, repeat('D', 5000)); |
| 266 |
insert into tv values (5, repeat('N', 2999)); |
| 267 |
|
| 268 |
update tb1 set b=repeat('B', 3000) where a in (15,16,17,18,19,20); |
| 269 |
delete from tb1 where a in (21,22,23,24,25); |
| 270 |
insert into tb1 values (1, repeat('D', 4000)); |
| 271 |
insert into tb1 values (2, repeat('N', 4000)); |
| 272 |
insert into tb1 values (3, repeat('B', 3000)); |
| 273 |
insert into tb1 values (4, repeat('D', 5000)); |
| 274 |
insert into tb1 values (5, repeat('N', 2999)); |
| 275 |
|
| 276 |
update tb2 set b=repeat('I', 3000), c=repeat('L', 4000) where a in (15,16,17,18,19,20); |
| 277 |
delete from tb2 where a in (21,22,23,24,25); |
| 278 |
insert into tb2 values (1, repeat('F', 4000), repeat('Y', 3000)); |
| 279 |
insert into tb2 values (2, repeat('W', 4000), repeat('S', 3500)); |
| 280 |
insert into tb2 values (3, repeat('P', 3000), repeat('A', 2999)); |
| 281 |
insert into tb2 values (4, repeat('M', 4500), repeat('L', 4000)); |
| 282 |
insert into tb2 values (5, repeat('C', 2999), repeat('!', 3200)); |
| 283 |
commit; |
| 284 |
|
| 285 |
--sync_slave_with_master |
| 286 |
--connection slave |
| 287 |
|
| 288 |
--echo Mixed operations |
| 289 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 290 |
--echo |
| 291 |
|
| 292 |
|
| 293 |
--connection master |
| 294 |
--echo |
| 295 |
--echo Bulk delete (20 x ~3kB) |
| 296 |
--echo ----------------------- |
| 297 |
|
| 298 |
begin; |
| 299 |
delete from tv where a in |
| 300 |
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); |
| 301 |
commit; |
| 302 |
|
| 303 |
--sync_slave_with_master |
| 304 |
--connection slave |
| 305 |
|
| 306 |
--echo Varchar table |
| 307 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 308 |
--echo |
| 309 |
|
| 310 |
--connection master |
| 311 |
|
| 312 |
begin; |
| 313 |
delete from tb1 where a in |
| 314 |
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); |
| 315 |
commit; |
| 316 |
|
| 317 |
--sync_slave_with_master |
| 318 |
--connection slave |
| 319 |
|
| 320 |
--echo 1 Blob table |
| 321 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 322 |
--echo |
| 323 |
|
| 324 |
--connection master |
| 325 |
|
| 326 |
begin; |
| 327 |
delete from tb2 where a in |
| 328 |
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); |
| 329 |
commit; |
| 330 |
|
| 331 |
--sync_slave_with_master |
| 332 |
--connection slave |
| 333 |
|
| 334 |
--echo 2 Blob table |
| 335 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 336 |
--echo |
| 337 |
|
| 338 |
|
| 339 |
--connection master |
| 340 |
drop table tv; |
| 341 |
drop table tb1; |
| 342 |
drop table tb2; |
| 343 |
|
| 344 |
--sync_slave_with_master |
| 345 |
--connection master |
| 346 |
|
| 347 |
--echo |
| 348 |
--echo Multiple key dependencies (3 x (I 10kB, D)) |
| 349 |
--echo ------------------------------------------- |
| 350 |
--echo Dependencies are on PK which is case-insensitive |
| 351 |
--echo and supports trailing spaces |
| 352 |
--disable_result_log |
| 353 |
|
| 354 |
# All VARBINARY columns on Master |
| 355 |
# Using InnoDB on Master as it allows us to |
| 356 |
# easily create Binlog transactions with a controlled |
| 357 |
# set of operations. |
| 358 |
# Ndb records only the final row transform for a single |
| 359 |
# transaction, and splits separate transactions into |
| 360 |
# epoch transactions at arbitrary points, making a |
| 361 |
# deterministic testcase difficult. |
| 362 |
|
| 363 |
create table tv (a varchar(20) character set utf8 primary key, |
| 364 |
b varbinary(5000)) engine=innodb; |
| 365 |
create table tb1(a varchar(20) character set utf8 primary key, |
| 366 |
b varbinary(5000)) engine=innodb; |
| 367 |
create table tb2(a varchar(20) character set utf8 primary key, |
| 368 |
b varbinary(5000), |
| 369 |
c varbinary(5000)) engine=innodb; |
| 370 |
|
| 371 |
--sync_slave_with_master |
| 372 |
--connection slave |
| 373 |
|
| 374 |
drop table tv; |
| 375 |
drop table tb1; |
| 376 |
drop table tb2; |
| 377 |
|
| 378 |
# Blobs in the blob tables on Slave, stored in Ndb |
| 379 |
|
| 380 |
create table tv (a varchar(20) character set utf8 primary key, |
| 381 |
b varbinary(5000)) engine=ndb; |
| 382 |
create table tb1(a varchar(20) character set utf8 primary key, |
| 383 |
b blob) engine=ndb; |
| 384 |
create table tb2(a varchar(20) character set utf8 primary key, |
| 385 |
b blob, |
| 386 |
c blob) engine=ndb; |
| 387 |
|
| 388 |
stop slave; |
| 389 |
set global replica_type_conversions="ALL_LOSSY,ALL_NON_LOSSY"; |
| 390 |
start slave; |
| 391 |
|
| 392 |
--connection master |
| 393 |
# Make sure the slave has e.g. 'discovered' all of the tables |
| 394 |
# before initialising counters |
| 395 |
insert into tsync values (2); |
| 396 |
insert into tv values ("Sync", "Sync"); |
| 397 |
insert into tb1 values ("Sync", "Sync"); |
| 398 |
insert into tb2 values ("Sync", "Sync", "Sync"); |
| 399 |
delete from tv; |
| 400 |
delete from tb1; |
| 401 |
delete from tb2; |
| 402 |
--sync_slave_with_master |
| 403 |
--connection slave |
| 404 |
|
| 405 |
--source suite/ndb/include/ndb_init_api_counts.inc |
| 406 |
|
| 407 |
--connection master |
| 408 |
|
| 409 |
begin; |
| 410 |
insert into tv values ("A", repeat('B', 5000)); |
| 411 |
delete from tv where a="a "; |
| 412 |
insert into tv values ("a", repeat('A', 5000)); |
| 413 |
delete from tv where a="A "; |
| 414 |
insert into tv values ("A", repeat('H', 5000)); |
| 415 |
delete from tv where a="a "; |
| 416 |
commit; |
| 417 |
|
| 418 |
--sync_slave_with_master |
| 419 |
--connection slave |
| 420 |
|
| 421 |
--echo Varchar table |
| 422 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 423 |
--echo |
| 424 |
|
| 425 |
--connection master |
| 426 |
|
| 427 |
begin; |
| 428 |
insert into tb1 values ("a", repeat('B', 5000)); |
| 429 |
delete from tb1 where a="A"; |
| 430 |
insert into tb1 values ("a ", repeat('A', 5000)); |
| 431 |
delete from tb1 where a="A "; |
| 432 |
insert into tb1 values ("a", repeat('H', 5000)); |
| 433 |
delete from tb1 where a="A"; |
| 434 |
commit; |
| 435 |
|
| 436 |
--sync_slave_with_master |
| 437 |
--connection slave |
| 438 |
|
| 439 |
--echo 1 Blob table |
| 440 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 441 |
--echo |
| 442 |
|
| 443 |
|
| 444 |
--connection master |
| 445 |
|
| 446 |
begin; |
| 447 |
insert into tb2 values ("a ", repeat('B', 5000), repeat('C', 5000)); |
| 448 |
delete from tb2 where a="a"; |
| 449 |
insert into tb2 values ("A ", repeat('A', 5000), repeat('M', 5000)); |
| 450 |
delete from tb2 where a="A"; |
| 451 |
insert into tb2 values ("a", repeat('H', 5000), repeat('F', 5000)); |
| 452 |
delete from tb2 where a="A"; |
| 453 |
commit; |
| 454 |
|
| 455 |
--sync_slave_with_master |
| 456 |
--connection slave |
| 457 |
|
| 458 |
--echo 2 Blob table |
| 459 |
--source suite/ndb/include/ndb_diff_api_counts.inc |
| 460 |
--echo |
| 461 |
|
| 462 |
set global replica_type_conversions=""; |
| 463 |
set global ndb_batch_size=@s_batch_size; |
| 464 |
set ndb_batch_size=@s_batch_size; |
| 465 |
set global ndb_blob_write_batch_bytes=@s_blob_write_batch; |
| 466 |
set ndb_blob_write_batch_bytes=@s_blob_write_batch; |
| 467 |
set global ndb_blob_read_batch_bytes=@s_blob_read_batch; |
| 468 |
set ndb_blob_read_batch_bytes=@s_blob_read_batch; |
| 469 |
|
| 470 |
|
| 471 |
--enable_query_log |
| 472 |
|
| 473 |
--connection master |
| 474 |
drop table tv; |
| 475 |
drop table tsync; |
| 476 |
drop table tb1; |
| 477 |
drop table tb2; |
| 478 |
|
| 479 |
--source include/rpl_end.inc |