-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathalter_sync.test
112 lines (83 loc) · 3.46 KB
/
alter_sync.test
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
#
# RENAME-related tests which require debug sync.
#
--source include/have_debug_sync.inc
###########################################################################
--source include/count_sessions.inc
###########################################################################
--echo #
--echo # Bug#21966802: MAKE OPERATIONS ON DD TABLES IMMUNE TO KILL
--echo #
--enable_connect_log
--echo # Create a new connection.
connect (con1, localhost, root,,);
--echo # Create a table and Alter it, but stop executing right before the
--echo # object is stored persistently.
CREATE TABLE t1 (pk INTEGER PRIMARY KEY);
SET DEBUG_SYNC= 'before_storing_dd_object SIGNAL before_store WAIT_FOR cont';
--SEND ALTER TABLE t1 ADD fld1 INT;
connection default;
--echo # From the default connection, get the thread id of the rename, and
--echo # kill the query.
SET DEBUG_SYNC= 'now WAIT_FOR before_store';
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE "ALTER TABLE%" INTO @thread_id;
KILL QUERY @thread_id;
SET DEBUG_SYNC= 'now SIGNAL cont';
connection con1;
--echo # Though KILL QUERY is executed when ALTER TABLE's THD is in the kill immune mode,
--echo # killed status for THD is set only while exiting from the kill immune mode.
--echo # Code checking THD::killed status outside kill immune mode reports an error.
--error ER_QUERY_INTERRUPTED
--reap
connection default;
--echo # Disconnect and cleanup.
DROP TABLE t1;
disconnect con1;
SET DEBUG_SYNC= 'RESET';
--disable_connect_log
###########################################################################
--echo #
--echo # Bug#24571427 MYSQLDUMP & MYSQLPUMP MAY FAIL WHEN
--echo # DDL STATEMENTS ARE RUNNING
--echo #
--disable_warnings
SET DEBUG_SYNC= 'RESET';
DROP SCHEMA IF EXISTS test_i_s;
--enable_warnings
CREATE SCHEMA test_i_s;
USE test_i_s;
CREATE TABLE t1(a INT) ENGINE=InnoDB;
--connection default
SET DEBUG_SYNC='alter_table_before_rename_result_table SIGNAL blocked WAIT_FOR i_s_select';
--echo # Sending ALTER Command
--send ALTER TABLE t1 modify column a varchar(30);
connect (con_mysqldump,localhost,root,,);
--echo # Wait until ALTER stopped before renaming the temporary file it created.
SET DEBUG_SYNC= 'now WAIT_FOR blocked';
--echo # Verify that #sql... tables are not seen by I_S and SHOW
SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test_i_s' AND TABLE_NAME like '#sql%';
SHOW TABLES FROM test_i_s;
--echo # Make sure mysqldump/mysqlpump ignores the #sql... tables.
--echo # mysqldump fails to acquire the lock without the fix.
--let $file = $MYSQLTEST_VARDIR/tmp/bug24571427.sql
--exec $MYSQL_DUMP --no-tablespaces --databases test_i_s --ignore-table=test_i_s.t1 > $file
--exec $MYSQL_PUMP --databases test_i_s --exclude-tables=t1 > $file
--remove_file $file
--echo # Allow ALTER to continue.
SET DEBUG_SYNC= 'now SIGNAL i_s_select';
--disconnect con_mysqldump
--source include/wait_until_disconnected.inc
--connection default
--echo # Reaping "ALTER ..."
--reap
--echo # Verify if the ALTERed TABLE is not-hidden
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test_i_s';
--echo # Verify if inplace alter also keeps the table not-hidden.
ALTER TABLE t1 add column (c2 int);
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test_i_s';
--connection default
SET DEBUG_SYNC= 'RESET';
SET GLOBAL DEBUG='';
DROP SCHEMA test_i_s;
--source include/wait_until_count_sessions.inc
###########################################################################