File: dd_debug.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (356 lines) | stat: -rw-r--r-- 11,956 bytes parent folder | download
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#
# Tests for data-dictionary implementation requiring debug build of server.
#

--source include/have_debug.inc
--source include/have_debug_sync.inc

--source include/count_sessions.inc

let $MYSQLD_DATADIR= `SELECT @@datadir`;

###########################################################################

--echo ###################################################################
--echo #
--echo # Bug#20290768 - server crash in table_share_utils::fill_partitioning_from_dd
--echo #
--echo ###################################################################

SET GLOBAL DEBUG='+d,weak_object_impl_store_fail_before_store_children';
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 (pk INT, col1 INT) ENGINE=InnoDB PARTITION BY KEY(pk) PARTITIONS 2;
SET GLOBAL DEBUG='-d,weak_object_impl_store_fail_before_store_children';

--echo # Without fix, following statement crashed.
CREATE TABLE t1 (pk INT, col1 INT) ENGINE=InnoDB PARTITION BY KEY(pk) PARTITIONS 2;
DROP TABLE t1;


--enable_connect_log

--echo ###################################################################
--echo #
--echo # WL#6378: New data dictionary.
--echo #
--echo # Provoke various error situations during DDL operations
--echo # on the dictionary objects.
--echo #
--echo # Note: Some of the error situations result in an inconsistency
--echo #       between the global data dictionary and the SE or the
--echo #       file system. These are known issues that will be
--echo #       addressed in WL#7743.
--echo #
--echo ###################################################################
--echo #

# These can be removed after WL#9536 is implemented
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Operating system error number .* in a file operation");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* The error means the system cannot find the path specified");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Cannot open datafile for read-only");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Cannot delete tablespace .* because it is not found in the tablespace memory cache");

--echo # 1. Schemata
--echo # 1.1 Fail while storing dd object during create.

SET DEBUG= '+d, fail_while_storing_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
CREATE SCHEMA s1;
SET DEBUG= '-d, fail_while_storing_dd_object';
--echo # Do it for real.
CREATE SCHEMA s1;

--echo # 1.2a Fail while acquiring dd object during alter.

SET DEBUG= '+d, fail_while_acquiring_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
ALTER SCHEMA s1 DEFAULT COLLATE 'utf8_bin';
SET DEBUG= '-d, fail_while_acquiring_dd_object';

--echo # 1.2b Fail while storing  dd object during alter.

SET DEBUG= '+d, fail_while_storing_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
ALTER SCHEMA s1 DEFAULT COLLATE 'utf8_bin';
SET DEBUG= '-d, fail_while_acquiring_dd_object';

--echo # 1.3a Fail while acquiring dd object during drop.

--connect (con1, localhost, root,,)
SET DEBUG_SYNC= 'before_acquire_in_drop_schema SIGNAL before_acquire WAIT_FOR cont';
--send DROP SCHEMA s1

--connection default
SET DEBUG_SYNC= 'now WAIT_FOR before_acquire';
SET GLOBAL DEBUG= '+d, fail_while_acquiring_dd_object';
SET DEBUG_SYNC= 'now SIGNAL cont';

--connection con1
--error ER_LOCK_WAIT_TIMEOUT
--reap

--echo # Disconnect and cleanup.
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
SET DEBUG_SYNC= 'RESET';
SET GLOBAL DEBUG= '-d, fail_while_acquiring_dd_object';

--echo # 1.3b No schema found during drop.

SET DEBUG= '+d, pretend_no_schema_in_drop_schema';
--replace_result $MYSQLD_DATADIR ./ \\ /
--error ER_SCHEMA_DIR_UNKNOWN 
DROP SCHEMA s1;
SET DEBUG= '-d, pretend_no_schema_in_drop_schema';

--echo # 1.3c Fail while dropping dd object during drop.

SET DEBUG= '+d, fail_while_dropping_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
DROP SCHEMA s1;
SET DEBUG= '-d, fail_while_dropping_dd_object';
--echo # Do it for real.
DROP SCHEMA s1;
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT COUNT(*) FROM mysql.schemata WHERE name LIKE 's1';
SET SESSION debug= '-d,skip_dd_table_access_check';

--echo ###################################################################
--echo #
--echo # 2. Tables
--echo # 2.1a Fail while storing dd object during create.

SET DEBUG= '+d, fail_while_storing_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
CREATE TABLE t1 (pk INT PRIMARY KEY);
SET DEBUG= '-d, fail_while_storing_dd_object';

--echo # 2.1b No tablespace object during create.

--error ER_TABLESPACE_MISSING_WITH_NAME
CREATE TABLE t1 (pk INT PRIMARY KEY) TABLESPACE no_such_tablespace;

--echo # 2.1c Fail while acquiring tablespace object during create.

--connect (con1, localhost, root,,)
SET DEBUG_SYNC= 'before_acquire_in_read_tablespace_encryption SIGNAL before_acquire WAIT_FOR cont';
--send CREATE TABLE t1 (pk INT PRIMARY KEY) TABLESPACE no_such_tablespace;

--connection default
SET DEBUG_SYNC= 'now WAIT_FOR before_acquire';
SET GLOBAL DEBUG= '+d, fail_while_acquiring_dd_object';
SET DEBUG_SYNC= 'now SIGNAL cont';

--connection con1
--error ER_LOCK_WAIT_TIMEOUT
--reap

--echo # Disconnect and cleanup.
--disconnect con1
--source include/wait_until_disconnected.inc
--connection default
SET DEBUG_SYNC= 'RESET';
SET GLOBAL DEBUG= '-d, fail_while_acquiring_dd_object';

--echo # Do it for real.
CREATE TABLE t1 (pk INT PRIMARY KEY);

--echo # 2.2 Fail while acquiring dd object during alter.

SET DEBUG= '+d, fail_while_acquiring_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 ADD COLUMN c1 INT;
SET DEBUG= '-d, fail_while_acquiring_dd_object';

--echo # 2.3 Fail while dropping dd object during drop.

SET DEBUG= '+d, fail_while_dropping_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
DROP TABLE t1;
SET DEBUG= '-d, fail_while_dropping_dd_object';
--echo # Do it for real.
DROP TABLE IF EXISTS t1;

--echo ###################################################################
--echo #
--echo # 3. Views
--echo # 3.1 Fail while storing dd object during create.

CREATE TABLE v1_base_table (pk INT PRIMARY KEY);
SET DEBUG= '+d, fail_while_storing_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
CREATE VIEW v1 AS SELECT * from v1_base_table;
SET DEBUG= '-d, fail_while_storing_dd_object';
--echo # Do it for real.
CREATE VIEW v1 AS SELECT pk from v1_base_table;

--echo # 3.2 Fail while acquiring dd object during alter.

SET DEBUG= '+d, fail_while_acquiring_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
ALTER VIEW v1 AS SELECT pk FROM t1;
SET DEBUG= '-d, fail_while_acquiring_dd_object';

--echo # 3.3 Fail while dropping dd object during drop.

SET DEBUG= '+d, fail_while_dropping_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
DROP VIEW v1;
SET DEBUG= '-d, fail_while_dropping_dd_object';
--echo # Do it for real.
DROP VIEW v1;
DROP TABLE v1_base_table;


--echo ###################################################################
--echo #
--echo # 4. Tablespaces

--echo # 4.1 Fail while storing dd object during create.

SET DEBUG= '+d, fail_while_storing_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
SET DEBUG= '-d, fail_while_storing_dd_object';

--echo # There should be no trace left in the data-dictionary
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT COUNT(*) FROM mysql.tablespaces WHERE name LIKE 'ts1';
SET SESSION debug= '-d,skip_dd_table_access_check';

--error ER_TABLESPACE_MISSING_WITH_NAME
DROP TABLESPACE ts1;

--echo # Then, we can do it for real.
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';

--echo # 4.2 Fail while acquiring dd object during alter:
--echo #     Skipped, since InnoDB does not suppoer
--echo #     ALTER TABLESPACE yet.

--echo # 4.3 Fail while dropping dd object during drop.

SET DEBUG= '+d, fail_while_dropping_dd_object';
--error ER_LOCK_WAIT_TIMEOUT
DROP TABLESPACE ts1;
SET DEBUG= '-d, fail_while_dropping_dd_object';

--echo # Tablespace is still in the data-dictionary.
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT COUNT(*) FROM mysql.tablespaces WHERE name LIKE 'ts1';

--echo # Here, the global DD and InnoDB are out of sync. To get
--echo # out of this, we must do a drop, which fails since the
--echo # object does not exist in the SE, but which still
--echo # removes the tablespace from the DD.
--echo # Note: The statement below fails, but removes entry for
--echo #       ts1 from mysql.tablespaces.
--echo # Do it for real.
DROP TABLESPACE ts1;
SELECT COUNT(*) FROM mysql.tablespaces WHERE name LIKE 'ts1';
SET SESSION debug= '-d,skip_dd_table_access_check';

--echo ###################################################################
--echo #
--echo # WL#8150: Dictionary cache.
--echo #
--echo # Verify that calls to Dictionary_client::drop() while executing
--echo # ALTER TABLE will make the dropped object disappear, and that
--echo # the shared cache will not be contaminated with the dropped
--echo # object (which will make subsequent DDL operations fail due to
--echo # the shared cache being out of sync with the persistent tables).
--echo #
--echo ###################################################################
--echo #

# Errors found during RQG testing of WL#7743 have been reduced to the
# following statement sequences:

CREATE TABLE t1 (pk INT PRIMARY KEY);
CREATE VIEW v1 AS SELECT * FROM t1;
ALTER TABLE t1 RENAME TO t2, MODIFY COLUMN pk INTEGER;
DROP TABLE IF EXISTS t1;
DROP VIEW v1;
DROP TABLE t2;

CREATE TABLE t1 (pk INT PRIMARY KEY);
CREATE TABLE t2 (i INT);
CREATE VIEW v1 AS SELECT * FROM t1, t2;
DROP TABLE t2;
ALTER TABLE t1 RENAME TO t2, MODIFY COLUMN pk INTEGER;
DROP TABLE IF EXISTS t1;
DROP VIEW v1;
DROP TABLE t2;

CREATE TABLE t1(a INT PRIMARY KEY);
CREATE VIEW v1 AS SELECT * FROM t1;
ALTER TABLE t1 RENAME TO t2, ALGORITHM= COPY;
DROP TABLE IF EXISTS t1;
DROP TABLE t2;
DROP VIEW v1;

--echo #
--echo # Bug#25587256 NEWDD: FK: NEED TO SET PROPER REFERENCED COLUMN CASE
--echo #

CREATE TABLE t1 (pk INT PRIMARY KEY);
CREATE TABLE t2 (fk INT, FOREIGN KEY (FK) REFERENCES t1 (PK));

SHOW CREATE TABLE t2;
SET SESSION debug= '+d,skip_dd_table_access_check';
# Case should match SHOW CREATE TABLE output.
SELECT foreign_key_column_usage.referenced_column_name
FROM mysql.foreign_key_column_usage, mysql.foreign_keys, mysql.tables
WHERE tables.name= 't2'
AND tables.id = foreign_keys.table_id
AND foreign_keys.id = foreign_key_column_usage.foreign_key_id;
SET SESSION debug= '-d,skip_dd_table_access_check';

DROP TABLE t2, t1;

--echo #
--echo # Bug#25887335 : TEST CASE INNODB_MYSQL_SYNC CRASH ON PB2 RUN.
--echo #
CREATE TABLE t1(a INT) Engine=InnoDB;
INSERT INTO t1 VALUES (1), (2);

connect (con1, localhost, root);
let $con1_id= `select connection_id()`;
SET DEBUG_SYNC= "open_and_process_table SIGNAL kill_truncate WAIT_FOR killed";
--echo # Sending: (not reaped since connection is killed later)
--echo # Default connection tries to kill con1 when it is in the kill immune mode
--echo # In this mode, state of the kill operation state is stored and applied
--echo # while exiting from the mode.
--echo # Without fix socket of the con1 was not closed. So the error message
--echo # was sent to client and cause the assertion.
--send TRUNCATE t1

connection default;
SET DEBUG_SYNC= "now WAIT_FOR kill_truncate";
--replace_result $con1_id con1_id
eval KILL $con1_id;
SET DEBUG_SYNC= "now SIGNAL killed";

#Cleanup
DROP TABLE t1;
disconnect con1;
SET DEBUG_SYNC= "RESET";

--echo #
--echo # Bug#27960500: UPGRADE 5.7 -> 8.0.11 -> 8.0.{12,13} FAILS DUE TO FTS TABLES WITH 0 TIMESTAMPS
--echo #
CREATE TABLE t1(pk INT PRIMARY KEY, s VARCHAR(10), FULLTEXT idx(s));
SET debug = '+d,skip_dd_table_access_check';
--let $assert_cond = "[SELECT COUNT(*) FROM mysql.tables WHERE created = 0 OR last_altered = 0]" = 0
--let $assert_text = There are no tables with 0 timestamps.
--source include/assert.inc
SET debug = DEFAULT;
DROP TABLE t1;

--echo ###################################################################

--disable_connect_log
--source include/wait_until_count_sessions.inc

###########################################################################