Debian Codegraph @

mysql-test/suite/s3/replication_mixed.result

raw
1 include/master-slave.inc
2 [connection master]
3 set binlog_format=mixed;
4 RESET MASTER;
5 connection slave;
6 set binlog_format=mixed;
7 RESET MASTER;
8 connection master;
9 connection slave;
10 connection master;
11 #
12 # Test ALTER TABLE ENGINE S3
13 #
14 create table t1 (a int, b int) engine=aria;
15 insert into t1 select seq,seq+10 from seq_1_to_10;
16 connection slave;
17 connection master;
18 alter table t1 engine=s3;
19 show create table t1;
20 Table Create Table
21 t1 CREATE TABLE `t1` (
22 `a` int(11) DEFAULT NULL,
23 `b` int(11) DEFAULT NULL
24 ) ENGINE=S3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1
25 connection slave;
26 use database;
27 select * from t1 limit 2;
28 a b
29 1 11
30 2 12
31 connection master;
32 alter table t1 add column c int;
33 connection slave;
34 select * from t1,t1 as t1_tmp limit 2;
35 a b c a b c
36 1 11 NULL 1 11 NULL
37 2 12 NULL 1 11 NULL
38 # Now test when the .frm table is out of date on the slave
39 stop slave;
40 connection master;
41 alter table t1 add column d int, engine=s3;
42 connection slave;
43 select * from t1 limit 2;
44 a b c d
45 1 11 NULL NULL
46 2 12 NULL NULL
47 start slave;
48 connection master;
49 connection slave;
50 select * from t1 limit 2;
51 a b c d
52 1 11 NULL NULL
53 2 12 NULL NULL
54 # Same without tables in the table cache;
55 stop slave;
56 flush tables;
57 connection master;
58 alter table t1 add column e int, engine=s3;
59 connection slave;
60 select * from t1 limit 2;
61 a b c d e
62 1 11 NULL NULL NULL
63 2 12 NULL NULL NULL
64 start slave;
65 connection master;
66 connection slave;
67 select * from t1 limit 2;
68 a b c d e
69 1 11 NULL NULL NULL
70 2 12 NULL NULL NULL
71 connection master;
72 # Convert S3 table to Aria. Rows should be binary logged
73 alter table t1 engine=aria;
74 connection slave;
75 select * from t1 limit 2;
76 a b c d e
77 1 11 NULL NULL NULL
78 2 12 NULL NULL NULL
79 show create table t1;
80 Table Create Table
81 t1 CREATE TABLE `t1` (
82 `a` int(11) DEFAULT NULL,
83 `b` int(11) DEFAULT NULL,
84 `c` int(11) DEFAULT NULL,
85 `d` int(11) DEFAULT NULL,
86 `e` int(11) DEFAULT NULL
87 ) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1
88 # Convert S3 table to Aria with rename. Rows should be binary logged
89 connection master;
90 alter table t1 engine=s3;
91 alter table t1 rename t2, engine=aria;
92 connection slave;
93 select * from t2 limit 2;
94 a b c d e
95 1 11 NULL NULL NULL
96 2 12 NULL NULL NULL
97 show create table t2;
98 Table Create Table
99 t2 CREATE TABLE `t2` (
100 `a` int(11) DEFAULT NULL,
101 `b` int(11) DEFAULT NULL,
102 `c` int(11) DEFAULT NULL,
103 `d` int(11) DEFAULT NULL,
104 `e` int(11) DEFAULT NULL
105 ) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1
106 connection master;
107 drop table t2;
108 connection slave;
109 connection master;
110 #
111 # Test RENAME
112 #
113 create table t1 (a int, b int) engine=aria;
114 insert into t1 select seq,seq+10 from seq_1_to_10;
115 alter table t1 engine=s3;
116 rename table t1 to t2;
117 connection slave;
118 select * from t1 limit 2;
119 ERROR 42S02: Table 'database.t1' doesn't exist
120 select * from t2 limit 2;
121 a b
122 1 11
123 2 12
124 connection master;
125 alter table t2 add column f int, rename t1;
126 select * from t1 limit 2;
127 a b f
128 1 11 NULL
129 2 12 NULL
130 connection slave;
131 select * from t1 limit 2;
132 a b f
133 1 11 NULL
134 2 12 NULL
135 select * from t2 limit 2;
136 ERROR 42S02: Table 'database.t2' doesn't exist
137 connection slave;
138 stop slave;
139 connection master;
140 rename table t1 to t2;
141 create table t1 (a int) engine=aria;
142 drop table t1;
143 create table if not exists t1 (a int, b int) engine=aria;
144 drop table t1;
145 create or replace table t1 (a int, b int, c int) engine=aria;
146 alter table t1 engine=s3;
147 connection slave;
148 start slave;
149 connection master;
150 connection slave;
151 show create table t1;
152 Table Create Table
153 t1 CREATE TABLE `t1` (
154 `a` int(11) DEFAULT NULL,
155 `b` int(11) DEFAULT NULL,
156 `c` int(11) DEFAULT NULL
157 ) ENGINE=S3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1
158 select * from t1 limit 2;
159 a b c
160 select * from t2 limit 2;
161 a b f
162 1 11 NULL
163 2 12 NULL
164 connection master;
165 #
166 # Test DROP
167 #
168 drop table t1,t2;
169 connection slave;
170 select * from t1 limit 2;
171 ERROR 42S02: Table 'database.t1' doesn't exist
172 select * from t2 limit 2;
173 ERROR 42S02: Table 'database.t2' doesn't exist
174 connection master;
175 #
176 # Test LIKE
177 #
178 create table t1 (a int,b int);
179 alter table t1 engine=s3;
180 create table t2 like t1;
181 ERROR HY000: Can't create table `database`.`t2` (errno: 131 "Command not supported by the engine")
182 connection slave;
183 show create table t2;
184 ERROR 42S02: Table 'database.t2' doesn't exist
185 connection master;
186 drop table if exists t1,t2;
187 Warnings:
188 Note 1051 Unknown table 'database.t2'
189 #
190 # Check slave binary log
191 #
192 connection slave;
193 include/show_binlog_events.inc
194 Log_name Pos Event_type Server_id End_log_pos Info
195 slave-bin.000001 # Gtid # # GTID #-#-#
196 slave-bin.000001 # Query # # create database database
197 slave-bin.000001 # Gtid # # GTID #-#-#
198 slave-bin.000001 # Query # # use `database`; create table t1 (a int, b int) engine=aria
199 slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
200 slave-bin.000001 # Query # # use `database`; insert into t1 select seq,seq+10 from seq_1_to_10
201 slave-bin.000001 # Query # # COMMIT
202 slave-bin.000001 # Gtid # # GTID #-#-#
203 slave-bin.000001 # Query # # use `database`; alter table t1 engine=s3
204 slave-bin.000001 # Gtid # # GTID #-#-#
205 slave-bin.000001 # Query # # use `database`; set @@sql_if_exists=1; alter table t1 add column c int
206 slave-bin.000001 # Gtid # # GTID #-#-#
207 slave-bin.000001 # Query # # use `database`; set @@sql_if_exists=1; alter table t1 add column d int, engine=s3
208 slave-bin.000001 # Gtid # # GTID #-#-#
209 slave-bin.000001 # Query # # use `database`; flush tables
210 slave-bin.000001 # Gtid # # GTID #-#-#
211 slave-bin.000001 # Query # # use `database`; set @@sql_if_exists=1; alter table t1 add column e int, engine=s3
212 slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
213 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
214 slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t1` (
215 `a` int(11) DEFAULT NULL,
216 `b` int(11) DEFAULT NULL,
217 `c` int(11) DEFAULT NULL,
218 `d` int(11) DEFAULT NULL,
219 `e` int(11) DEFAULT NULL
220 ) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1
221 slave-bin.000001 # Annotate_rows # # alter table t1 engine=aria
222 slave-bin.000001 # Table_map # # table_id: # (database.t1)
223 slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
224 slave-bin.000001 # Query # # COMMIT
225 slave-bin.000001 # Gtid # # GTID #-#-#
226 slave-bin.000001 # Query # # use `database`; alter table t1 engine=s3
227 slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
228 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
229 slave-bin.000001 # Query # # use `database`; CREATE OR REPLACE TABLE `t2` (
230 `a` int(11) DEFAULT NULL,
231 `b` int(11) DEFAULT NULL,
232 `c` int(11) DEFAULT NULL,
233 `d` int(11) DEFAULT NULL,
234 `e` int(11) DEFAULT NULL
235 ) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci PAGE_CHECKSUM=1
236 slave-bin.000001 # Annotate_rows # # alter table t1 rename t2, engine=aria
237 slave-bin.000001 # Table_map # # table_id: # (database.t2)
238 slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
239 slave-bin.000001 # Query # # COMMIT
240 slave-bin.000001 # Gtid # # GTID #-#-#
241 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t2` /* generated by server */
242 slave-bin.000001 # Gtid # # GTID #-#-#
243 slave-bin.000001 # Query # # use `database`; create table t1 (a int, b int) engine=aria
244 slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
245 slave-bin.000001 # Query # # use `database`; insert into t1 select seq,seq+10 from seq_1_to_10
246 slave-bin.000001 # Query # # COMMIT
247 slave-bin.000001 # Gtid # # GTID #-#-#
248 slave-bin.000001 # Query # # use `database`; alter table t1 engine=s3
249 slave-bin.000001 # Gtid # # GTID #-#-#
250 slave-bin.000001 # Query # # use `database`; set @@sql_if_exists=1; rename table t1 to t2
251 slave-bin.000001 # Gtid # # GTID #-#-#
252 slave-bin.000001 # Query # # use `database`; set @@sql_if_exists=1; alter table t2 add column f int, rename t1
253 slave-bin.000001 # Gtid # # GTID #-#-#
254 slave-bin.000001 # Query # # use `database`; set @@sql_if_exists=1; rename table t1 to t2
255 slave-bin.000001 # Gtid # # GTID #-#-#
256 slave-bin.000001 # Query # # use `database`; create table t1 (a int) engine=aria
257 slave-bin.000001 # Gtid # # GTID #-#-#
258 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
259 slave-bin.000001 # Gtid # # GTID #-#-#
260 slave-bin.000001 # Query # # use `database`; create table if not exists t1 (a int, b int) engine=aria
261 slave-bin.000001 # Gtid # # GTID #-#-#
262 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t1` /* generated by server */
263 slave-bin.000001 # Gtid # # GTID #-#-#
264 slave-bin.000001 # Query # # use `database`; create or replace table t1 (a int, b int, c int) engine=aria
265 slave-bin.000001 # Gtid # # GTID #-#-#
266 slave-bin.000001 # Query # # use `database`; alter table t1 engine=s3
267 slave-bin.000001 # Gtid # # GTID #-#-#
268 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by server */
269 slave-bin.000001 # Gtid # # GTID #-#-#
270 slave-bin.000001 # Query # # use `database`; create table t1 (a int,b int)
271 slave-bin.000001 # Gtid # # GTID #-#-#
272 slave-bin.000001 # Query # # use `database`; alter table t1 engine=s3
273 slave-bin.000001 # Gtid # # GTID #-#-#
274 slave-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t1`,`t2` /* generated by server */
275 connection master;
276 #
277 # MDEV-24351: S3, same-backend replication: Dropping a table on master
278 # causes error on slave
279 #
280 show variables like 's3_replicate_alter_as_create_select';
281 Variable_name Value
282 s3_replicate_alter_as_create_select ON
283 connection slave;
284 create table t3 (a int, b int) engine=aria;
285 insert into t3 values (1,1),(2,2),(3,3);
286 alter table t3 engine=s3;
287 connection master;
288 drop table t3;
289 # Must show "DROP TABLE IF EXISTS t3", not just "DROP TABLE t3"
290 include/show_binlog_events.inc
291 Log_name Pos Event_type Server_id End_log_pos Info
292 master-bin.000001 # Gtid # # GTID #-#-#
293 master-bin.000001 # Query # # use `database`; DROP TABLE IF EXISTS `t3` /* generated by server */
294 connection slave;
295 connection master;
296 #
297 # clean up
298 #
299 connection slave;
300 include/rpl_end.inc