summaryrefslogtreecommitdiff
path: root/mysql-test/extra/rpl_tests/rpl_row_img_blobs.test
blob: 9d3a0a593e3f2975275509d46f880625e3151ba3 (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
#  WL#5096
#  
#  Description 
#  ===========
#
#  This test case covers Requirements for replication using different
#  combinations of indexes and blob fields. 
#
#  It acts as a complement for rpl_row_img_sanity tests as it checks
#  that in a chained replication scenario, replication does not break.
#
#  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 extra/rpl_tests/rpl_row_img_blobs.test
# 

-- connection server_1

-- let $diff_table=test.t
let $i= 7;
while($i)
{
  -- connection server_1
  SET SQL_LOG_BIN=0;

  -- connection server_2
  SET SQL_LOG_BIN=0;

  -- connection server_3
  SET SQL_LOG_BIN=0;

  # 
  # The comments below (on create table) must be read with the SQL
  # instructions issued later in mind. Declaring a table obviously is 
  # not enough to assert anything.
  #
  # Also, the tests in this file make more sense when performed with
  # binlog_row_image configured as NOBLOB.
  #

  if ($i == 1) {
    -- echo ### Asserts that declaring a blob as part of a primary key does not break replication
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_2_engine;
    -- connection server_3 
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c2(512))) engine= $server_3_engine;
  }
  if ($i == 2)
  { 
    -- echo ### Asserts that declaring a blob as part of a unique (not null) key does not break replication
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 blob NOT NULL, c3 int, unique key(c2(512))) engine= $server_3_engine;
  }
  if ($i == 3)
  {
    -- echo ### Asserts that declaring a blob in a key does not break replication
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c2(512))) engine= $server_3_engine;

  }
  if ($i == 4) {
    -- echo ### Asserts that updates without blobs in the BI (PK exists int the table)
    -- echo ### will not break replication
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_2_engine;
    -- connection server_3 
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, primary key(c1)) engine= $server_3_engine;

  }
  if ($i == 5)
  { 
    -- echo ### Asserts that updates without blobs in the BI (UK NOT NULL exists in the table) 
    -- echo ### will not break replication
    -- connection server_1
    --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int NOT NULL, c2 blob NOT NULL, c3 int, unique key(c1)) engine= $server_3_engine;

  }
  if ($i == 6)
  { 
    -- echo ### Asserts that updates without blobs in the AI (they are not updated) 
    -- echo ### will not break replication (check even if there is a key in the table)
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int, key(c1)) engine= $server_3_engine;

  }
  if ($i == 7)
  { 
    -- echo ### Asserts that updates without blobs in the AI (they are not updated) 
    -- echo ### will not break replication (check when there is no key in the table)
    -- connection server_1
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_1_engine;
    -- connection server_2
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int) engine= $server_2_engine;
    -- connection server_3
    --eval CREATE TABLE t (c1 int, c2 blob, c3 int) 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

  -- let $blob1= "a"
  -- let $blob2= "b"
  -- let $blob3= "c"

  -- eval INSERT INTO t VALUES (1, $blob1, 10)
  -- eval INSERT INTO t VALUES (2, $blob2, 20)
  -- eval INSERT INTO t VALUES (3, $blob3, 30)
  
  -- source include/rpl_sync.inc

  -- connection server_1
  -- eval UPDATE t SET c1=10 WHERE c2=$blob1
  -- eval UPDATE t SET c1=20 WHERE c1=2
  -- eval UPDATE t SET c1=30 WHERE c3=30
  -- eval UPDATE t SET c3=40 WHERE c1=30

  -- 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
  -- eval DELETE FROM t WHERE c2=$blob1
  -- eval DELETE FROM t WHERE c1=20
  -- eval 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;
}