summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/s3/replication_partition.result
blob: 18f5ae7c650214508e1cf887b63739f5e465a891 (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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
include/master-slave.inc
[connection master]
connection slave;
use database;
connection master;
#
# Check replication of parititioned S3 tables
#
CREATE TABLE t1 (
c1 INT DEFAULT NULL
) ENGINE=Aria
PARTITION BY HASH (c1)
PARTITIONS 3;
INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202);
ALTER TABLE t1 ENGINE=S3;
connection slave;
connection master;
ALTER TABLE t1 ADD PARTITION PARTITIONS 6;
select sum(c1) from t1;
sum(c1)
609
connection slave;
connection master;
ALTER TABLE t1 ADD COLUMN c INT;
select sum(c1) from t1;
sum(c1)
609
connection slave;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL
) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
 PARTITION BY HASH (`c1`)
PARTITIONS 9
select sum(c1) from t1;
sum(c1)
609
connection master;
drop table t1;
#
# Checking that the slave is keeping in sync with changed partitions
#
CREATE TABLE t1 (
c1 int primary key,
c2 int DEFAULT NULL
) ENGINE=InnoDB
PARTITION BY RANGE (c1)
(PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN (400));
insert into t1 select seq*100,seq*100 from seq_1_to_3;
alter table t1 engine=S3;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` int(11) NOT NULL,
  `c2` int(11) DEFAULT NULL,
  PRIMARY KEY (`c1`)
) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
 PARTITION BY RANGE (`c1`)
(PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3,
 PARTITION `p2` VALUES LESS THAN (300) ENGINE = S3,
 PARTITION `p3` VALUES LESS THAN (400) ENGINE = S3)
connection slave;
select sum(c1) from t1;
sum(c1)
600
stop slave;
connection master;
ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (500));
connection slave;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` int(11) NOT NULL,
  `c2` int(11) DEFAULT NULL,
  PRIMARY KEY (`c1`)
) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
 PARTITION BY RANGE (`c1`)
(PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3,
 PARTITION `p2` VALUES LESS THAN (300) ENGINE = S3,
 PARTITION `p3` VALUES LESS THAN (400) ENGINE = S3,
 PARTITION `p4` VALUES LESS THAN (500) ENGINE = S3)
select sum(c1) from t1;
sum(c1)
600
start slave;
connection master;
connection slave;
select sum(c1)+0 from t1;
sum(c1)+0
600
stop slave;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c1` int(11) NOT NULL,
  `c2` int(11) DEFAULT NULL,
  PRIMARY KEY (`c1`)
) ENGINE=S3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
 PARTITION BY RANGE (`c1`)
(PARTITION `p1` VALUES LESS THAN (200) ENGINE = S3,
 PARTITION `p2` VALUES LESS THAN (300) ENGINE = S3,
 PARTITION `p3` VALUES LESS THAN (400) ENGINE = S3,
 PARTITION `p4` VALUES LESS THAN (500) ENGINE = S3)
connection master;
drop table t1;
connection slave;
select sum(c1) from t1;
ERROR 42S02: Table 'database.t1' doesn't exist
start slave;
connection master;
connection slave;
connection master;
#
# Check altering partitioned table to S3 and back
# Checks also rename partitoned table and drop partition
#
CREATE TABLE t2 (
c1 int primary key,
c2 int DEFAULT NULL
) ENGINE=InnoDB
PARTITION BY RANGE (c1)
(PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN (400));
insert into t2 select seq*100,seq*100 from seq_1_to_3;
alter table t2 engine=S3;
rename table t2 to t1;
alter table t1 drop partition p1;
connection slave;
select sum(c1) from t1;
sum(c1)
500
connection master;
alter table t1 engine=innodb;
connection slave;
select sum(c1) from t1;
sum(c1)
500
connection master;
drop table t1;
#
# Check that slaves ignores changes to S3 tables.
#
connection master;
CREATE TABLE t1 (
c1 int primary key,
c2 int DEFAULT NULL
) ENGINE=InnoDB
PARTITION BY RANGE (c1)
(PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN (400));
insert into t1 select seq*100,seq*100 from seq_1_to_3;
create table t2 like t1;
alter table t2 remove partitioning;
insert into t2 values (450,450);
connection slave;
stop slave;
connection master;
alter table t1 engine=s3;
alter table t2 engine=s3;
ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (500));
alter table t1 exchange partition p4 with table t2;
select count(*) from t1;
count(*)
4
drop table t1,t2;
connection slave;
start slave;
connection master;
connection slave;
select sum(c1) from t1;
ERROR 42S02: Table 'database.t1' doesn't exist
connection master;
#
# Check slave binary log
#
connection slave;
include/show_binlog_events.inc
Log_name	Pos	Event_type	Server_id	End_log_pos	Info
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	create database database
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; CREATE TABLE t1 (
c1 INT DEFAULT NULL
) ENGINE=Aria
PARTITION BY HASH (c1)
PARTITIONS 3
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; INSERT INTO t1 VALUE (1), (2), (101), (102), (201), (202)
slave-bin.000001	#	Query	#	#	COMMIT
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; ALTER TABLE t1 ENGINE=S3
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; ALTER TABLE t1 ADD PARTITION PARTITIONS 6
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; ALTER TABLE t1 ADD COLUMN c INT
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; CREATE TABLE t1 (
c1 int primary key,
c2 int DEFAULT NULL
) ENGINE=InnoDB
PARTITION BY RANGE (c1)
(PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN (400))
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; insert into t1 select seq*100,seq*100 from seq_1_to_3
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; alter table t1 engine=S3
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (500))
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; CREATE TABLE t2 (
c1 int primary key,
c2 int DEFAULT NULL
) ENGINE=InnoDB
PARTITION BY RANGE (c1)
(PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN (400))
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; insert into t2 select seq*100,seq*100 from seq_1_to_3
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; alter table t2 engine=S3
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; rename table t2 to t1
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; alter table t1 drop partition p1
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
slave-bin.000001	#	Query	#	#	use `database`; CREATE OR REPLACE TABLE `t1` (
  `c1` int(11) NOT NULL,
  `c2` int(11) DEFAULT NULL,
  PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
 PARTITION BY RANGE (`c1`)
(PARTITION `p2` VALUES LESS THAN (300) ENGINE = InnoDB,
 PARTITION `p3` VALUES LESS THAN (400) ENGINE = InnoDB)
slave-bin.000001	#	Annotate_rows	#	#	alter table t1 engine=innodb
slave-bin.000001	#	Table_map	#	#	table_id: # (database.t1)
slave-bin.000001	#	Write_rows_v1	#	#	table_id: # flags: STMT_END_F
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; CREATE TABLE t1 (
c1 int primary key,
c2 int DEFAULT NULL
) ENGINE=InnoDB
PARTITION BY RANGE (c1)
(PARTITION p1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300),
PARTITION p3 VALUES LESS THAN (400))
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; insert into t1 select seq*100,seq*100 from seq_1_to_3
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; create table t2 like t1
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; alter table t2 remove partitioning
slave-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; insert into t2 values (450,450)
slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; alter table t1 engine=s3
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; alter table t2 engine=s3
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; ALTER TABLE t1 ADD PARTITION (PARTITION p4 VALUES LESS THAN (500))
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; set @@sql_if_exists=1; alter table t1 exchange partition p4 with table t2
slave-bin.000001	#	Gtid	#	#	GTID #-#-#
slave-bin.000001	#	Query	#	#	use `database`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by server */
connection master;
#
# clean up
#
connection slave;
include/rpl_end.inc