Debian Codegraph @

mysql-test/suite/ndb/r/ndb_ddl_open_trans.result

raw
1 set @@global.ndb_schema_dist_lock_wait_timeout = 1;
2 create table t1 ( a int ) engine = ndb;
3 begin;
4 insert into t1 values(1);
5 alter table t1 rename t2;
6 Warnings:
7 Warning 1296 Node <nodeid> 'Distribution of RENAME TABLE 't1' failed'
8 commit;
9 drop table t2;
10 set global ndb_dbg_check_shares=1;
11 set global ndb_dbg_check_shares=1;
12 create table t1 ( a int primary key) engine = ndb;
13 begin;
14 insert into t1 values(1);
15 alter table t1 algorithm=inplace, add column b int column_format dynamic;
16 Warnings:
17 Warning 1296 Node <nodeid> 'Distribution of ALTER TABLE 't1' failed'
18 commit;
19 drop table t1;
20 set global ndb_dbg_check_shares=1;
21 set global ndb_dbg_check_shares=1;
22 create table t1 ( a int primary key) engine = ndb;
23 begin;
24 insert into t1 values(1);
25 alter table t1 algorithm=copy, add column b int column_format dynamic;
26 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
27 commit;
28 drop table t1;
29 set global ndb_dbg_check_shares=1;
30 set global ndb_dbg_check_shares=1;
31 create table t1 ( a int primary key, b int) engine = ndb;
32 begin;
33 insert into t1 values(1, 1);
34 create index ind_b on t1(b) algorithm=inplace;
35 Warnings:
36 Warning 1296 Node <nodeid> 'Distribution of ALTER TABLE 't1' failed'
37 commit;
38 drop table t1;
39 set global ndb_dbg_check_shares=1;
40 set global ndb_dbg_check_shares=1;
41 create table t1 ( a int primary key, b int, index ind_b (b)) engine = ndb;
42 begin;
43 insert into t1 values(1, 1);
44 drop index ind_b on t1;
45 Warnings:
46 Warning 1296 Node <nodeid> 'Distribution of ALTER TABLE 't1' failed'
47 commit;
48 drop table t1;
49 set global ndb_dbg_check_shares=1;
50 set global ndb_dbg_check_shares=1;
51 create database testdb;
52 create table testdb.t1 (a int) engine = ndb;
53 begin;
54 insert into testdb.t1 values(1);
55 alter database testdb charset = latin1;
56 Warnings:
57 Warning 1296 Node <nodeid> 'Distribution of ALTER DATABASE 'testdb' failed'
58 commit;
59 drop database testdb;
60 set global ndb_dbg_check_shares=1;
61 set global ndb_dbg_check_shares=1;
62 Remote MDL lock claim failure
63 Server1 Create table
64 create table t1 (a int primary key, b int) engine=ndb;
65 insert into t1 values (1,1);
66 Add column c on server1
67
68 Server2 Get + hold MDL on table t1, no row locks
69 begin;
70 select * from t1;
71 a b
72 1 1
73
74 Server1 Send Alter add column, will stall due to remote MDL lock
75 alter table t1 add column c int; # Online alter;
76 Server2 Issue normal queries on table, causing table access, rollback etc
77
78 Server1 Allow ALTER to complete successfully
79
80 Server 1 Show table schema at origin
81 select * from t1;
82 a b c
83 1 1 NULL
84 show create table t1;
85 Table Create Table
86 t1 CREATE TABLE `t1` (
87 `a` int NOT NULL,
88 `b` int DEFAULT NULL,
89 `c` int DEFAULT NULL,
90 PRIMARY KEY (`a`)
91 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
92 desc t1;
93 Field Type Null Key Default Extra
94 a int NO PRI NULL
95 b int YES NULL
96 c int YES NULL
97 select column_name from information_schema.columns where table_name='t1';
98 COLUMN_NAME
99 a
100 b
101 c
102
103 Server2 Show schema at participant
104 select * from t1;
105 a b c
106 1 1 NULL
107 desc t1;
108 Field Type Null Key Default Extra
109 a int NO PRI NULL
110 b int YES NULL
111 c int YES NULL
112 select column_name from information_schema.columns where table_name='t1';
113 COLUMN_NAME
114 a
115 b
116 c
117 show create table t1;
118 Table Create Table
119 t1 CREATE TABLE `t1` (
120 `a` int NOT NULL,
121 `b` int DEFAULT NULL,
122 `c` int DEFAULT NULL,
123 PRIMARY KEY (`a`)
124 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
125 Add index c on server 1
126 Server2 Take + hold MDL lock again
127 begin;
128 select * from test.t1;
129 a b c
130 1 1 NULL
131 Server1 Issue another online DDL, will stall due to remote MDL lock
132 alter table t1 add index(c);;
133 Server2 Issue normal queries on table, causing table access, rollback etc
134
135 Server1 Allow ALTER to complete successfully
136
137 Server 1 Show table schema at origin
138 select * from t1;
139 a b c
140 1 1 NULL
141 show create table t1;
142 Table Create Table
143 t1 CREATE TABLE `t1` (
144 `a` int NOT NULL,
145 `b` int DEFAULT NULL,
146 `c` int DEFAULT NULL,
147 PRIMARY KEY (`a`),
148 KEY `c` (`c`)
149 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
150 desc t1;
151 Field Type Null Key Default Extra
152 a int NO PRI NULL
153 b int YES NULL
154 c int YES MUL NULL
155 select column_name from information_schema.columns where table_name='t1';
156 COLUMN_NAME
157 a
158 b
159 c
160
161 Server2 Show schema at participant
162 select * from t1;
163 a b c
164 1 1 NULL
165 desc t1;
166 Field Type Null Key Default Extra
167 a int NO PRI NULL
168 b int YES NULL
169 c int YES MUL NULL
170 select column_name from information_schema.columns where table_name='t1';
171 COLUMN_NAME
172 a
173 b
174 c
175 show create table t1;
176 Table Create Table
177 t1 CREATE TABLE `t1` (
178 `a` int NOT NULL,
179 `b` int DEFAULT NULL,
180 `c` int DEFAULT NULL,
181 PRIMARY KEY (`a`),
182 KEY `c` (`c`)
183 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
184 Now further changes in the opposite direction
185 Server2 -> Server1
186 Server1 Take and hold MDL lock
187 begin;
188 select * from test.t1;
189 a b c
190 1 1 NULL
191 Server2 Send Alter table add column, will stall due to remote MDL lock
192 alter table t1 add column d int;;
193 Server1 Issue normal queries on table, causing table access, rollback etc
194
195 Server2 Allow ALTER to complete successfully
196 Warnings:
197 Warning 1478 Converted FIXED field 'd' to DYNAMIC to enable online ADD COLUMN
198
199 Server 2 Show table schema at origin
200 select * from t1;
201 a b c d
202 1 1 NULL NULL
203 show create table t1;
204 Table Create Table
205 t1 CREATE TABLE `t1` (
206 `a` int NOT NULL,
207 `b` int DEFAULT NULL,
208 `c` int DEFAULT NULL,
209 `d` int DEFAULT NULL,
210 PRIMARY KEY (`a`),
211 KEY `c` (`c`)
212 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
213 desc t1;
214 Field Type Null Key Default Extra
215 a int NO PRI NULL
216 b int YES NULL
217 c int YES MUL NULL
218 d int YES NULL
219 select column_name from information_schema.columns where table_name='t1';
220 COLUMN_NAME
221 a
222 b
223 c
224 d
225
226 Server1 Show schema at participant
227 select * from t1;
228 a b c d
229 1 1 NULL NULL
230 desc t1;
231 Field Type Null Key Default Extra
232 a int NO PRI NULL
233 b int YES NULL
234 c int YES MUL NULL
235 d int YES NULL
236 select column_name from information_schema.columns where table_name='t1';
237 COLUMN_NAME
238 a
239 b
240 c
241 d
242 show create table t1;
243 Table Create Table
244 t1 CREATE TABLE `t1` (
245 `a` int NOT NULL,
246 `b` int DEFAULT NULL,
247 `c` int DEFAULT NULL,
248 `d` int DEFAULT NULL,
249 PRIMARY KEY (`a`),
250 KEY `c` (`c`)
251 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
252 Add index d on server 2
253 Server1 Take and hold MDL lock again
254 begin;
255 select * from test.t1;
256 a b c d
257 1 1 NULL NULL
258 Server2 Issue another online DDL, will stall due to remote MDL lock
259 alter table t1 add index(d);;
260 Server1 Issue normal queries on table, causing table access, rollback etc
261
262 Server2 Allow ALTER to complete successfully
263
264 Server 2 Show table schema
265 select * from t1;
266 a b c d
267 1 1 NULL NULL
268 show create table t1;
269 Table Create Table
270 t1 CREATE TABLE `t1` (
271 `a` int NOT NULL,
272 `b` int DEFAULT NULL,
273 `c` int DEFAULT NULL,
274 `d` int DEFAULT NULL,
275 PRIMARY KEY (`a`),
276 KEY `c` (`c`),
277 KEY `d` (`d`)
278 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
279 desc t1;
280 Field Type Null Key Default Extra
281 a int NO PRI NULL
282 b int YES NULL
283 c int YES MUL NULL
284 d int YES MUL NULL
285 select column_name from information_schema.columns where table_name='t1';
286 COLUMN_NAME
287 a
288 b
289 c
290 d
291
292 Server1 Show schema at participant
293 select * from t1;
294 a b c d
295 1 1 NULL NULL
296 desc t1;
297 Field Type Null Key Default Extra
298 a int NO PRI NULL
299 b int YES NULL
300 c int YES MUL NULL
301 d int YES MUL NULL
302 select column_name from information_schema.columns where table_name='t1';
303 COLUMN_NAME
304 a
305 b
306 c
307 d
308 show create table t1;
309 Table Create Table
310 t1 CREATE TABLE `t1` (
311 `a` int NOT NULL,
312 `b` int DEFAULT NULL,
313 `c` int DEFAULT NULL,
314 `d` int DEFAULT NULL,
315 PRIMARY KEY (`a`),
316 KEY `c` (`c`),
317 KEY `d` (`d`)
318 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
319 drop table t1;