Debian Codegraph @

mysql-test/suite/rpl/include/rpl_row_img_blobs.test

raw
1 # WL#5096
2 #
3 # Description
4 # ===========
5 #
6 # This test case covers Requirements for replication using different
7 # combinations of indexes and blob fields.
8 #
9 # It acts as a complement for rpl_row_img_sanity tests as it checks
10 # that in a chained replication scenario, replication does not break.
11 #
12 # Usage
13 # =====
14 #
15 # Before including this file the following variables should be set:
16 # * $server_1_engine
17 # * $server_2_engine
18 # * $server_3_engine
19 #
20 # Example:
21 #
22 # -- let $server_1_engine= Falcon
23 # -- let $server_2_engine= MyISAM
24 # -- let $server_3_engine= InnoDB
25 #
26 # -- source suite/rpl/include/rpl_row_img_blobs.test
27 #
28
29 -- connection server_1
30
31 -- let $diff_table=test.t
32 let $i= 7;
33 while($i)
34 {
35 -- connection server_1
36 SET SQL_LOG_BIN=0;
37
38 -- connection server_2
39 SET SQL_LOG_BIN=0;
40
41 -- connection server_3
42 SET SQL_LOG_BIN=0;
43
44 #
45 # The comments below (on create table) must be read with the SQL
46 # instructions issued later in mind. Declaring a table obviously is
47 # not enough to assert anything.
48 #
49 # Also, the tests in this file make more sense when performed with
50 # binlog_row_image configured as NOBLOB.
51 #
52
53 if ($i == 1) {
54 -- echo ### Asserts that declaring a blob as part of a primary key does not break replication
55 -- connection server_1
56 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_1_engine;
57 -- connection server_2
58 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_2_engine;
59 -- connection server_3
60 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_3_engine;
61 }
62 if ($i == 2)
63 {
64 -- echo ### Asserts that declaring a blob as part of a unique (not null) key does not break replication
65 -- connection server_1
66 --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_1_engine;
67 -- connection server_2
68 --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_2_engine;
69 -- connection server_3
70 --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_3_engine;
71 }
72 if ($i == 3)
73 {
74 -- echo ### Asserts that declaring a blob in a key does not break replication
75 -- connection server_1
76 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_1_engine;
77 -- connection server_2
78 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_2_engine;
79 -- connection server_3
80 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_3_engine;
81
82 }
83 if ($i == 4) {
84 -- echo ### Asserts that updates without blobs in the BI (PK exists int the table)
85 -- echo ### will not break replication
86 -- connection server_1
87 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_1_engine;
88 -- connection server_2
89 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_2_engine;
90 -- connection server_3
91 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_3_engine;
92
93 }
94 if ($i == 5)
95 {
96 -- echo ### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table)
97 -- echo ### will not break replication
98 -- connection server_1
99 --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_1_engine;
100 -- connection server_2
101 --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_2_engine;
102 -- connection server_3
103 --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_3_engine;
104
105 }
106 if ($i == 6)
107 {
108 -- echo ### Asserts that updates without blobs in the AI (they are not updated)
109 -- echo ### will not break replication (check even if there is a key in the table)
110 -- connection server_1
111 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_1_engine;
112 -- connection server_2
113 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_2_engine;
114 -- connection server_3
115 --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_3_engine;
116
117 }
118 if ($i == 7)
119 {
120 -- echo ### Asserts that updates without blobs in the AI (they are not updated)
121 -- echo ### will not break replication (check when there is no key in the table)
122 -- connection server_1
123 --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_1_engine;
124 -- connection server_2
125 --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_2_engine;
126 -- connection server_3
127 --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_3_engine;
128 }
129
130 -- connection server_1
131 SET SQL_LOG_BIN=1;
132
133 -- connection server_2
134 SET SQL_LOG_BIN=1;
135
136 -- connection server_3
137 SET SQL_LOG_BIN=1;
138
139 -- connection server_1
140
141 -- let $blob1= "a"
142 -- let $blob2= "b"
143 -- let $blob3= "c"
144
145 -- eval INSERT INTO t VALUES (1, $blob1, 10)
146 -- eval INSERT INTO t VALUES (2, $blob2, 20)
147 -- eval INSERT INTO t VALUES (3, $blob3, 30)
148
149 -- source include/rpl_sync.inc
150
151 -- connection server_1
152 -- eval UPDATE t SET c1=10 WHERE c2=$blob1
153 -- eval UPDATE t SET c1=20 WHERE c1=2
154 -- eval UPDATE t SET c1=30 WHERE c3=30
155 -- eval UPDATE t SET c3=40 WHERE c1=30
156
157 -- source include/rpl_sync.inc
158
159 -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
160 -- source include/diff_tables.inc
161
162 -- connection server_1
163 -- eval DELETE FROM t WHERE c2=$blob1
164 -- eval DELETE FROM t WHERE c1=20
165 -- eval DELETE FROM t
166
167 -- source include/rpl_sync.inc
168
169 -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
170 -- source include/diff_tables.inc
171
172 -- connection server_1
173
174 DROP TABLE t;
175
176 -- source include/rpl_sync.inc
177
178 dec $i;
179 }