| 1 |
--source include/have_ndb.inc |
| 2 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 3 |
|
| 4 |
# |
| 5 |
# basic test of blob replication for NDB |
| 6 |
# |
| 7 |
|
| 8 |
# easy test |
| 9 |
|
| 10 |
--connection master |
| 11 |
create table t1 ( |
| 12 |
a int not null primary key, |
| 13 |
b text not null |
| 14 |
) engine=ndb; |
| 15 |
|
| 16 |
insert into t1 values(1, repeat('abc',10)); |
| 17 |
insert into t1 values(2, repeat('def',200)); |
| 18 |
insert into t1 values(3, repeat('ghi',3000)); |
| 19 |
|
| 20 |
select 'M', a, sha1(b) from t1 |
| 21 |
order by a; |
| 22 |
|
| 23 |
--sync_slave_with_master |
| 24 |
--sleep 5 |
| 25 |
--connection slave |
| 26 |
select 'S', a, sha1(b) from t1 |
| 27 |
order by a; |
| 28 |
--connection master |
| 29 |
|
| 30 |
update t1 set b = repeat('xyz',3000) where a = 1; |
| 31 |
delete from t1 where a = 2; |
| 32 |
update t1 set b = concat(b,'xyz') where a = 3; |
| 33 |
|
| 34 |
select 'M', a, sha1(b) from t1 |
| 35 |
order by a; |
| 36 |
|
| 37 |
--sync_slave_with_master |
| 38 |
--sleep 5 |
| 39 |
--connection slave |
| 40 |
select 'S', a, sha1(b) from t1 |
| 41 |
order by a; |
| 42 |
|
| 43 |
--connection master |
| 44 |
drop table t1; |
| 45 |
--sync_slave_with_master |
| 46 |
|
| 47 |
# hard test |
| 48 |
|
| 49 |
--connection master |
| 50 |
create table t1 ( |
| 51 |
a int not null primary key, |
| 52 |
b text not null, |
| 53 |
c int, |
| 54 |
d longblob, |
| 55 |
e tinyblob |
| 56 |
) engine=ndbcluster; |
| 57 |
|
| 58 |
--disable_query_log |
| 59 |
# length 61 |
| 60 |
set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau'; |
| 61 |
set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz'; |
| 62 |
set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah'; |
| 63 |
--enable_query_log |
| 64 |
|
| 65 |
insert into t1 values ( |
| 66 |
0, repeat(@s2,454), 100, repeat(@s2,345), NULL); |
| 67 |
insert into t1 values ( |
| 68 |
1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1)); |
| 69 |
insert into t1 values ( |
| 70 |
2, '', 102, '', repeat(@s2,1)); |
| 71 |
insert into t1 values ( |
| 72 |
3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1)); |
| 73 |
insert into t1 values ( |
| 74 |
4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1)); |
| 75 |
insert into t1 values ( |
| 76 |
5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1)); |
| 77 |
insert into t1 values ( |
| 78 |
6, repeat(@s1,242), 106, NULL, repeat(@s1,1)); |
| 79 |
insert into t1 values ( |
| 80 |
7, repeat(@s1,30), 107, repeat(@s0,161), ''); |
| 81 |
insert into t1 values ( |
| 82 |
8, repeat(@s1,719), 108, repeat(@s2,104), NULL); |
| 83 |
insert into t1 values ( |
| 84 |
9, repeat(@s2,427), NULL, NULL, NULL); |
| 85 |
|
| 86 |
select 'M', a, sha1(b), c, sha1(d), sha1(e) |
| 87 |
from t1 order by a; |
| 88 |
|
| 89 |
--sync_slave_with_master |
| 90 |
--sleep 5 |
| 91 |
--connection slave |
| 92 |
select 'S', a, sha1(b), c, sha1(d), sha1(e) |
| 93 |
from t1 order by a; |
| 94 |
|
| 95 |
--connection master |
| 96 |
drop table t1; |
| 97 |
--sync_slave_with_master |
| 98 |
|
| 99 |
# table with varsize key (future cluster/schema) |
| 100 |
|
| 101 |
# sql/ha_ndbcluster_binlog.cc |
| 102 |
--connection master |
| 103 |
CREATE TABLE IF NOT EXISTS t1 ( |
| 104 |
db VARBINARY(63) NOT NULL, |
| 105 |
name VARBINARY(63) NOT NULL, |
| 106 |
slock BINARY(32) NOT NULL, |
| 107 |
query BLOB NOT NULL, |
| 108 |
node_id INT UNSIGNED NOT NULL, |
| 109 |
epoch BIGINT UNSIGNED NOT NULL, |
| 110 |
id INT UNSIGNED NOT NULL, |
| 111 |
version INT UNSIGNED NOT NULL, |
| 112 |
type INT UNSIGNED NOT NULL, |
| 113 |
PRIMARY KEY USING HASH (db,name)) |
| 114 |
ENGINE=NDB; |
| 115 |
|
| 116 |
insert into t1 values ('test','t1', |
| 117 |
'abc',repeat(@s0,10), 11,12,13,14,15); |
| 118 |
insert into t1 values ('test','t2', |
| 119 |
'def',repeat(@s1,100), 21,22,23,24,25); |
| 120 |
insert into t1 values ('test','t3', |
| 121 |
'ghi',repeat(@s2,1000),31,32,33,34,35); |
| 122 |
insert into t1 values ('testtttttttttt','t1', |
| 123 |
'abc',repeat(@s0,10), 11,12,13,14,15); |
| 124 |
insert into t1 values ('testttttttttttt','t1', |
| 125 |
'def',repeat(@s1,100), 21,22,23,24,25); |
| 126 |
insert into t1 values ('testtttttttttttt','t1', |
| 127 |
'ghi',repeat(@s2,1000),31,32,33,34,35); |
| 128 |
insert into t1 values ('t','t11111111111', |
| 129 |
'abc',repeat(@s0,10), 11,12,13,14,15); |
| 130 |
insert into t1 values ('t','t111111111111', |
| 131 |
'def',repeat(@s1,100), 21,22,23,24,25); |
| 132 |
insert into t1 values ('t','t1111111111111', |
| 133 |
'ghi',repeat(@s2,1000),31,32,33,34,35); |
| 134 |
|
| 135 |
select 'M', db, name, sha1(query), node_id, epoch, id, version, type |
| 136 |
from t1 order by db, name; |
| 137 |
|
| 138 |
--sync_slave_with_master |
| 139 |
--sleep 5 |
| 140 |
--connection slave |
| 141 |
select 'S', db, name, sha1(query), node_id, epoch, id, version, type |
| 142 |
from t1 order by db, name; |
| 143 |
|
| 144 |
--connection master |
| 145 |
drop table t1; |
| 146 |
--sync_slave_with_master |
| 147 |
|
| 148 |
# |
| 149 |
# view the binlog - not deterministic (mats) |
| 150 |
# |
| 151 |
|
| 152 |
#--connection master |
| 153 |
#let $VERSION=`select version()`; |
| 154 |
#--replace_result $VERSION VERSION |
| 155 |
#show binlog events; |
| 156 |
--source include/rpl_end.inc |