summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/rpl/include/rpl_row_img.test
blob: 9cf2b6f9e9ec6a7427789dd4db7af8b7fd890c96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#  WL#5096
#  
#  Description 
#  ===========
#
#  This test case checks replication between hosts with same index
#  structure but may differ on engines.
#
#  Usage
#  =====
#
#  Before including this file the following variables should be set:
#    * $server_1_engine
#    * $server_2_engine
#    * $server_3_engine
#
#  Example:
#
#     -- let $server_1_engine= Falcon
#     -- let $server_2_engine= MyISAM
#     -- let $server_3_engine= InnoDB
#
#     -- source suite/rpl/include/rpl_row_img.test
# 

-- connection server_1

-- let $diff_table=test.t

let $i= 12;
while($i)
{
  let $step= "";

  -- connection server_1
  SET SQL_LOG_BIN=0;

  -- connection server_2
  SET SQL_LOG_BIN=0;

  -- connection server_3
  SET SQL_LOG_BIN=0;

  if ($i == 1) {
    let $step= No keys;
    --echo ******* TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1)) engine= $server_3_engine;

  }
  if ($i == 2)
  { 
    let $step= One key;
    --echo ******* TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1)) engine= $server_3_engine;

  }
  if ($i == 3)
  {
    let $step= One Composite key;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c2)) engine= $server_3_engine;
  }  
  if ($i == 4)
  {
    let $step= One Unique key;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1)) engine= $server_3_engine;

  }  
  if ($i == 5)
  {
    let $step= One Composite Unique key;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c2)) engine= $server_3_engine;

  }  
  if ($i == 6)
  {
    let $step= One Primary key;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1)) engine= $server_3_engine;
  }  
  if ($i == 7)
  {
    let $step= One Composite Primary Key;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c2)) engine= $server_3_engine;
  } 
  if ($i == 8)
  {
    let $step= One Composite key with holes;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), key(c1,c3)) engine= $server_3_engine;
  }  
  if ($i == 9)
  {
    let $step= One Composite Unique key with holes;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
  }  
  if ($i == 10)
  {
    let $step= One Composite Primary Key with holes;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), primary key(c1,c3)) engine= $server_3_engine;
  } 
  if ($i == 11)
  {
    let $step= One Composite NOT NULL Unique key with holes;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
  }  
  if ($i == 12)
  {
    let $step= One Composite NOT NULL Unique key with holes in master, but NULLABLE on first slave;
    --echo ****** TEST: $step
    -- connection server_1
    --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 char(1), c3 char(1), c4 char(1), unique key(c1,c3)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int NOT NULL, c2 char(1), c3 char(1) NOT NULL, c4 char(1), unique key(c1,c3)) engine= $server_3_engine;
  }  

  -- connection server_1
  SET SQL_LOG_BIN=1;

  -- connection server_2
  SET SQL_LOG_BIN=1;

  -- connection server_3
  SET SQL_LOG_BIN=1;

  -- connection server_1
  INSERT INTO t VALUES (1, '1', '1', '1' );
  INSERT INTO t VALUES (4, '4', '4', '4' );
  INSERT INTO t VALUES (7, '7', '7', '7' );

  INSERT INTO t VALUES (9, '9', '9', NULL );

  INSERT INTO t VALUES (2, '1', '2', '2' );
  INSERT INTO t VALUES (3, '1', '3', '2' );
 
  -- source include/rpl_sync.inc

  -- connection server_1
  UPDATE t SET c4 = '7';

  UPDATE t SET c4 = '5' WHERE c1 = 1;
  UPDATE t SET c2 = '5' WHERE c1 = 1;
  UPDATE t SET c1 = '5' WHERE c1 = 1;

  UPDATE t SET c4 = '8' WHERE c2 = '4';
  UPDATE t SET c1 = '8' WHERE c2 = '4';
  UPDATE t SET c2 = '8' WHERE c2 = '4';

  UPDATE t SET c3 = '0' WHERE c4 = NULL;
  UPDATE t SET c2 = '0' WHERE c4 = '0';

  UPDATE t SET c2 = '2' WHERE c4 = '2';

  -- source include/rpl_sync.inc

  -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
  -- source include/diff_tables.inc


  -- connection server_1

  DELETE FROM t WHERE c1 = 7;
  DELETE FROM t WHERE c1 = 8;
  DELETE FROM t;

  -- source include/rpl_sync.inc

  -- let $diff_tables= server_1:$diff_table, server_2:$diff_table, server_3:$diff_table
  -- source include/diff_tables.inc

  -- connection server_1

  DROP TABLE t;

  -- source include/rpl_sync.inc

  dec $i;
}