1
#################################################
4
# Purpose: Test test that BLOBs are replicated
6
################################################
8
# Pre test clean up section
11
DROP TABLE IF EXISTS test.t1;
12
DROP TABLE IF EXISTS test.t2;
16
--echo ***** Table Create Section ****
19
--replace_result $engine_type #
20
eval CREATE TABLE test.t1 (c1 int not null auto_increment,
21
data LONGBLOB, PRIMARY KEY(c1))ENGINE=$engine_type;
24
--echo **** Data Insert Section test.t1 *****
26
INSERT INTO test.t1 VALUES (NULL, NULL);
27
INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
28
INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
31
--echo **** Data Insert Validation Master Section test.t1 ****
33
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
34
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
35
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
41
--echo **** Data Insert Validation Slave Section test.t1 ****
43
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
44
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
45
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
49
--echo **** Data Update Section test.t1 ****
51
UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
52
UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
55
--echo **** Data Update Validation Master Section test.t1 ****
57
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
58
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
59
# Sleep is needed for NDB to allow time for
60
# Injector thread to populate the bin log.
66
--echo **** Data Update Validation Slave Section test.t1 ****
68
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
69
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
72
--echo **** End Test Section test.t1 ****
75
--echo **** Create Table test.t2 ****
78
--replace_result $engine_type #
79
eval CREATE TABLE test.t2 (
80
c1 INT NOT NULL PRIMARY KEY,
84
KEY(c3))ENGINE=$engine_type;
88
--echo *** Setup Values For test.t2 ***
89
# x0 size 256 (current inline size)
90
set @x0 = '01234567012345670123456701234567';
91
set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
93
# b1 length 2000+256 (blob part aligned)
95
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
96
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
97
set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
98
set @b1 = concat(@b1,@x0);
101
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
102
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
103
set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
107
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
108
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
109
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
110
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
114
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
115
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
116
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
117
set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
120
--echo **** Data Insert Section test.t2 *****
122
INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
123
INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
126
--echo **** Data Insert Validation Master Section test.t2 ****
128
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
129
FROM test.t2 WHERE c1=1;
130
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
131
FROM test.t2 WHERE c1=2;
137
--echo **** Data Insert Validation Slave Section test.t2 ****
139
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
140
FROM test.t2 WHERE c1=1;
141
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
142
FROM test.t2 WHERE c1=2;
146
--echo **** Data Update Section test.t2 ****
148
UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
149
UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
152
--echo **** Data Update Validation Master Section test.t2 ****
154
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
155
FROM test.t2 WHERE c1=1;
156
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
157
FROM test.t2 WHERE c1=2;
158
# Sleep is needed for NDB to allow time for
159
# Injector thread to populate the bin log.
165
--echo **** Data Update Validation Slave Section test.t2 ****
167
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
168
FROM test.t2 WHERE c1=1;
169
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
170
FROM test.t2 WHERE c1=2;
174
# Post test clean up section
175
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql
176
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql
178
diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_blob_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_blob_slave.sql;
180
DROP TABLE IF EXISTS test.t1;
181
DROP TABLE IF EXISTS test.t2;
182
# ensure cleanup on slave as well:
183
# ndb blob tables consist of several tables
184
# if cluster is shutdown while not all tables are
185
# properly dropped, the table becomes inconsistent
186
# and wrecks later test cases
187
--sync_slave_with_master