Debian Codegraph @

mysql-test/suite/clone/t/error_ddl.test

raw
1 # Test clone error cases with concurrent DDL
2 --source include/have_debug_sync.inc
3 --source include/count_sessions.inc
4
5 --disable_query_log
6 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* InnoDB redo logging is disabled. All data could be lost in case of a server crash");
7 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* InnoDB redo logging is enabled. Data is now safe and can be recovered in case of a server crash.");
8 --enable_query_log
9
10 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
11 --let $CLONE_DATADIR2 = $MYSQL_TMP_DIR/data_new2
12 --let $MYSQLD_DATADIR= `select @@datadir;`
13
14 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
15 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
16
17 --echo # 1. CLONE blocked by DDL at beginning
18 --connect (con1,localhost,root,,)
19 --echo # In connection CON1
20 SET DEBUG_SYNC = 'fil_ibd_created_space SIGNAL start_clone WAIT_FOR resume_ddl_1';
21 --send CREATE TABLE t1(col1 int)
22
23 --connection default
24 --echo # In connection DEFAULT
25 --let $CON_ID= `SELECT CONNECTION_ID()`
26
27 SET DEBUG_SYNC = 'now WAIT_FOR start_clone';
28 SET DEBUG_SYNC = 'clone_begin_wait_ddl SIGNAL start_ddl_1 WAIT_FOR resume_clone_1';
29 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl_2 WAIT_FOR resume_clone_2';
30 --source ../include/clone_command_send.inc
31
32 --connect (con2,localhost,root,,)
33 --echo # In connection CON2
34 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_1';
35 SET DEBUG_SYNC = 'clone_notify_ddl_before_state_block SIGNAL resume_ddl_1';
36 --send CREATE TABLE t2(col1 int)
37
38 --connection con1
39 --echo # In connection CON1
40 --echo # Reap CREATE TABLE t1
41 --reap
42 SET DEBUG_SYNC= 'now SIGNAL resume_clone_1';
43
44 --connection con2
45 --echo # In connection CON2
46 --echo # Reap CREATE TABLE t2
47 --reap
48
49 --echo # Disconnect CON2
50 --disconnect con2
51
52 --connection con1
53 --echo # In connection CON1
54 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl_2';
55
56 --echo # 1A. TOO MANY CLONE IN PROGRESS
57 --let $CLONE_DATADIR = $CLONE_DATADIR2
58 --let $clone_err = ER_CLONE_TOO_MANY_CONCURRENT_CLONES
59 --source ../include/clone_command.inc
60 --let $clone_err = 0
61 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
62
63 --echo # 2. ALTER INSTANCE while clone in progress
64 --error ER_CLONE_IN_PROGRESS
65 ALTER INSTANCE DISABLE INNODB REDO_LOG;
66
67 INSERT INTO t1 values(10), (20), (30);
68 SELECT * FROM t1 ORDER BY col1;
69
70 --echo # 3. ALTER DISCARD while clone in progress
71 --error ER_CLONE_IN_PROGRESS
72 ALTER TABLE t1 DISCARD TABLESPACE;
73
74 --echo # 4. ALTER IMPORT while clone in progress
75 --error ER_CLONE_IN_PROGRESS
76 ALTER TABLE t1 IMPORT TABLESPACE;
77
78 --echo # 5. KILL CLONE command while in progress
79 --replace_result $CON_ID CON_ID
80 --eval KILL QUERY $CON_ID
81 SET DEBUG_SYNC= 'now SIGNAL resume_clone_2';
82
83 connection default;
84 --echo # In connection DEFAULT
85 --error ER_QUERY_INTERRUPTED
86 --reap
87
88 --force-rmdir $CLONE_DATADIR
89 SET DEBUG_SYNC = 'RESET';
90 DROP TABLE t2;
91
92 --echo # 6. Force clone to abort by DDL
93 SET GLOBAL DEBUG = '+d,clone_ddl_error_abort';
94
95 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_ddl WAIT_FOR resume_clone';
96 --source ../include/clone_command_send.inc
97
98 --connection con1
99 --echo # In connection CON1
100 SET DEBUG_SYNC = 'now WAIT_FOR start_ddl';
101 SET DEBUG_SYNC = 'clone_notify_ddl_before_state_block SIGNAL resume_clone';
102
103 CREATE TABLE t2(col1 int);
104 INSERT INTO t2 VALUES(10), (20), (30);
105 SELECT * FROM t2 ORDER BY col1;
106
107 connection default;
108 --echo # In connection DEFAULT
109 --error ER_CLONE_DDL_IN_PROGRESS
110 --reap
111
112 SET GLOBAL DEBUG = '-d,clone_ddl_error_abort';
113
114 --force-rmdir $CLONE_DATADIR
115 SET DEBUG_SYNC = 'RESET';
116
117 --echo #Cleanup
118 DROP TABLE t1;
119 DROP TABLE t2;
120
121 connection default;
122 --echo # In connection DEFAULT
123
124 disconnect con1;
125 SET DEBUG_SYNC = 'RESET';
126
127 --echo # Attempt to uninstall clone if there
128 --error 0, ER_PLUGIN_CANNOT_BE_UNINSTALLED
129 UNINSTALL PLUGIN clone;
130
131 --echo # Restart server
132 --source include/wait_until_count_sessions.inc
133 --source include/restart_mysqld.inc
134
135 --echo # Uninstall clone if there
136 --error 0, ER_SP_DOES_NOT_EXIST
137 UNINSTALL PLUGIN clone;