Debian Codegraph @

mysql-test/suite/innodb/t/ddl_log_error.test

raw
1 #
2 # BUG#31236217 : NOT HANDLING ERROR RETURNED FROM DDL_LOG_TABLE::INSERT MIGHT
3 # BREAK ATOMIC DDL
4 #
5
6 --source include/have_debug.inc
7 --source include/not_valgrind.inc
8
9 --disable_query_log
10 call mtr.add_suppression("\\[Error\\] \\[[^]]*\\] \\[[^]]*\\] Couldn't insert entry in ddl log for ddl.");
11 call mtr.add_suppression("\\[Error\\] \\[[^]]*\\] \\[[^]]*\\] Couldn't write DDL LOG for");
12 --enable_query_log
13
14 --echo # Setup
15 CREATE TABLE t1 (c1 INT);
16 CREATE TABLESPACE my_ts ADD DATAFILE "my_ts.ibd";
17
18 # Return error from insert into ddl_log
19 SET SESSION DEBUG="+d,ddl_log_return_error_from_insert";
20
21 --echo # Run few DDLs. All DDLs should give error now.
22
23 --error ER_ERROR_ON_RENAME
24 ALTER TABLE t1 RENAME to t2;
25
26 --error ER_GET_ERRNO
27 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=COPY;
28
29 --error ER_GET_ERRNO
30 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INPLACE;
31
32 --error ER_ENGINE_CANT_DROP_TABLE
33 DROP TABLE t1;
34
35 SET SESSION DEBUG="-d,ddl_log_return_error_from_insert";
36
37
38 --echo # Restart with keyring plugin
39 let $restart_parameters = restart: --early-plugin-load=keyring_file=$KEYRING_PLUGIN --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT;
40 --source include/restart_mysqld_no_echo.inc
41
42 # Return error from insert into ddl_log
43 SET SESSION DEBUG="+d,ddl_log_return_error_from_insert";
44
45 --error ER_ALTER_FILEGROUP_FAILED
46 ALTER TABLESPACE my_ts ENCRYPTION='Y';
47
48 SET SESSION DEBUG="-d,ddl_log_return_error_from_insert";
49
50 --echo # Cleanup
51 DROP TABLESPACE my_ts;
52 DROP TABLE t1;
53 remove_file $MYSQL_TMP_DIR/mysecret_keyring;
54
55 --echo # Restarting server without keyring to restore server state
56 let $restart_parameters = restart: ;
57 --source include/restart_mysqld.inc
58
59 --echo #
60 --echo # Bug #32716838 ALTER TABLE MAY CRASH IF DDL LOG LOSE,
61 --echo # IN NON-FILE-PER-TABLE MODE
62 --echo #
63 SET @innodb_file_per_table_orig=@@innodb_file_per_table;
64 SET GLOBAL innodb_file_per_table = 0;
65 SELECT @@innodb_file_per_table;
66
67 --echo # Setup
68 CREATE TABLE t1 (c1 INT);
69
70 # Return error from insert into ddl_log
71 SET SESSION DEBUG="+d,ddl_log_return_error_from_insert";
72
73 --echo # Run few DDLs. All DDLs should give error now.
74
75 --error ER_GET_ERRNO
76 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=COPY;
77
78 --error ER_GET_ERRNO
79 ALTER TABLE t1 ADD COLUMN c2 INT, ALGORITHM=INPLACE;
80
81 --error ER_ENGINE_CANT_DROP_TABLE
82 DROP TABLE t1;
83
84 SET SESSION DEBUG="-d,ddl_log_return_error_from_insert";
85 --echo # Cleanup
86 DROP TABLE t1;
87 SET GLOBAL innodb_file_per_table=@innodb_file_per_table_orig;