| 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 |
--enable_query_log |
| 5 |
|
| 6 |
--connection master |
| 7 |
use test; |
| 8 |
|
| 9 |
CREATE TABLE t1 ( |
| 10 |
id int(11) NOT NULL, |
| 11 |
value varbinary(4000), # VARBINARY |
| 12 |
PRIMARY KEY (id) |
| 13 |
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; |
| 14 |
|
| 15 |
--sync_slave_with_master |
| 16 |
--connection slave |
| 17 |
|
| 18 |
stop slave; |
| 19 |
set global replica_type_conversions='ALL_LOSSY,ALL_NON_LOSSY'; |
| 20 |
start slave; |
| 21 |
|
| 22 |
# Drop and recreate table with blob storage |
| 23 |
# Master will log varbinary changes discretely |
| 24 |
# Slave will have to do more work to apply |
| 25 |
# |
| 26 |
use test; |
| 27 |
drop table t1; |
| 28 |
|
| 29 |
CREATE TABLE t1 ( |
| 30 |
id int(11) NOT NULL, |
| 31 |
value blob, # BLOB |
| 32 |
PRIMARY KEY (id) |
| 33 |
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; |
| 34 |
|
| 35 |
--connection master |
| 36 |
|
| 37 |
# Issue a number of discrete transactions affecting |
| 38 |
# the same blob value |
| 39 |
# These are likely to be applied in a single batch |
| 40 |
# on the slave, testing Blob batching |
| 41 |
# |
| 42 |
insert into t1(id,value) values(3,repeat(0x23,240)); |
| 43 |
update t1 set value=repeat(0x24,240) where id=3; |
| 44 |
update t1 set value=repeat(0x25,250) where id=3; |
| 45 |
update t1 set value=repeat(0x30,400) where id=3; |
| 46 |
update t1 set value=repeat(0x32,320) where id=3; |
| 47 |
update t1 set value=repeat(0x33,330) where id=3; |
| 48 |
|
| 49 |
# Here we check that we can synchronise with |
| 50 |
# the slave - aka nothing stops the Slave |
| 51 |
# |
| 52 |
--sync_slave_with_master |
| 53 |
|
| 54 |
select id, length(value), value from test.t1 where id=3; |
| 55 |
|
| 56 |
--connection master |
| 57 |
delete from test.t1 where id=3; |
| 58 |
|
| 59 |
--sync_slave_with_master |
| 60 |
|
| 61 |
--connection master |
| 62 |
|
| 63 |
# This time we issue transactions designed to |
| 64 |
# cause an identified batching issue |
| 65 |
# This is where an update truncates a blob |
| 66 |
# down to the inline size precisely |
| 67 |
# |
| 68 |
insert into t1(id,value) values(3,repeat('D',2000)); |
| 69 |
update t1 set value=repeat('P',256); |
| 70 |
|
| 71 |
--sync_slave_with_master |
| 72 |
|
| 73 |
# Check state on the slave |
| 74 |
select id, length(value), value from test.t1 where id=3; |
| 75 |
|
| 76 |
# Check that we can modify it on the slave |
| 77 |
update t1 set value=repeat('S', 2000); |
| 78 |
|
| 79 |
# Done, cleanup |
| 80 |
--connection master |
| 81 |
drop table test.t1; |
| 82 |
|
| 83 |
--sync_slave_with_master |
| 84 |
|
| 85 |
--connection slave |
| 86 |
set global replica_type_conversions=''; |
| 87 |
|
| 88 |
|
| 89 |
--source include/rpl_end.inc |