Debian Codegraph @

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

raw
1 # Test clone when tablespace file size is increasing in different stages
2 # This would follow a rollback during recovery
3
4 --source include/have_debug_sync.inc
5 --source include/count_sessions.inc
6
7 # Compressed table do not support more than 16K page size
8 --source include/have_innodb_max_16k.inc
9
10 ## Install plugin
11 --let $CLONE_DATADIR = $MYSQL_TMP_DIR/data_new
12
13 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
14 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
15
16 ## Create test schema
17 --source ../include/create_schema.inc
18
19 # Modify the schema and add compressed table
20 DROP TABLE t1;
21 DROP TABLE t2;
22
23 # Create table with compressed row format using default KEY_BLOCK_SIZE.
24 CREATE TABLE t1(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB)
25 ROW_FORMAT = COMPRESSED;
26
27 # Create table in general tablespace
28 CREATE TABLESPACE tbs1 ADD DATAFILE 'tbs1_data1.ibd';
29 CREATE TABLE t2(col1 INT PRIMARY KEY, col2 int, col3 varchar(64), col4 BLOB)
30 TABLESPACE = tbs1;
31
32 ## Execute Clone while concurrent DMLs are in progress
33
34 # Insert 20 rows
35 call execute_dml(0, 0, 20, 20, 10, 0);
36
37 # Check base rows
38 SHOW CREATE TABLE t1;
39
40 SELECT count(*) from t1;
41 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
42 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
43
44 SHOW CREATE TABLE t2;
45 SELECT count(*) from t2;
46 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
47 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
48
49 ## Test-1: Extend tablespace file during file copy
50
51 --echo # In connection default - Cloning database
52 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_insert1 WAIT_FOR resume_clone1';
53 --source ../include/clone_command_send.inc
54
55 --echo # In connection con1 - Insert [20 Rows - No commit]
56 connect (con1,localhost,root,,);
57 SET DEBUG_SYNC = 'now WAIT_FOR start_insert1';
58 START TRANSACTION;
59 call execute_dml(0, 50, 20, 20, 500, 0);
60
61 --echo # Flush all dirty buffers
62 SET GLOBAL innodb_buf_flush_list_now = 1;
63 SET DEBUG_SYNC = 'now SIGNAL resume_clone1';
64
65 connection default;
66 --echo # In connection default - Cloning database
67 --reap
68
69 --echo # In connection con1
70 connection con1;
71 ROLLBACK;
72
73 connection default;
74 --echo # In connection default - Cloning database
75 disconnect con1;
76
77 --echo # Restart cloned database
78 --replace_result $CLONE_DATADIR CLONE_DATADIR
79 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
80 --source include/restart_mysqld.inc
81
82 # Check table in cloned database
83 SHOW CREATE TABLE t1;
84 SELECT count(*) from t1;
85 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
86 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
87
88 SHOW CREATE TABLE t2;
89 SELECT count(*) from t2;
90 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
91 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
92
93 # Execute procedure to delete all rows and insert
94 call execute_dml(3, 0, 1, 1, 1, 0);
95 call execute_dml(0, 0, 10, 10, 2, 0);
96 commit;
97
98 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
99 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
100
101 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
102 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
103
104 #Cleanup
105 --let restart_parameters="restart:"
106 --source include/restart_mysqld.inc
107 --force-rmdir $CLONE_DATADIR
108
109 ## Test-2: Extend tablespace file during page copy
110
111 --echo # In connection default - Cloning database
112 SET DEBUG_SYNC = 'clone_file_copy SIGNAL start_dml WAIT_FOR resume_clone2';
113 SET DEBUG_SYNC = 'clone_page_copy SIGNAL start_insert2 WAIT_FOR resume_clone3';
114 --source ../include/clone_command_send.inc
115
116 --echo # In connection con1 - Insert [20 Rows - No commit]
117 connect (con1,localhost,root,,);
118 SET DEBUG_SYNC = 'now WAIT_FOR start_dml';
119 START TRANSACTION;
120 call execute_dml(1, 0, 20, 20, 10, 1);
121 COMMIT;
122
123 --echo # Flush all dirty buffers
124 SET GLOBAL innodb_buf_flush_list_now = 1;
125 SET DEBUG_SYNC = 'now SIGNAL resume_clone2';
126
127 connection con1;
128 SET DEBUG_SYNC = 'now WAIT_FOR start_insert2';
129 START TRANSACTION;
130 call execute_dml(0, 50, 20, 20, 500, 0);
131
132 --echo # Flush all dirty buffers
133 SET GLOBAL innodb_buf_flush_list_now = 1;
134 SET DEBUG_SYNC = 'now SIGNAL resume_clone3';
135
136 connection default;
137 --echo # In connection default - Cloning database
138 --replace_result $CLONE_DATADIR CLONE_DATADIR
139 --reap
140
141 --echo # In connection con1
142 connection con1;
143 ROLLBACK;
144
145 connection default;
146 --echo # In connection default - Cloning database
147 disconnect con1;
148
149 --echo # Restart cloned database
150 --replace_result $CLONE_DATADIR CLONE_DATADIR
151 --let restart_parameters="restart: --datadir=$CLONE_DATADIR"
152 --source include/restart_mysqld.inc
153
154 # Check table in cloned database
155 SHOW CREATE TABLE t1;
156 SELECT count(*) from t1;
157 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
158 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
159
160 SHOW CREATE TABLE t2;
161 SELECT count(*) from t2;
162 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
163 SELECT col1, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
164
165 # Execute procedure to delete all rows and insert
166 call execute_dml(3, 0, 1, 1, 1, 0);
167 call execute_dml(0, 0, 10, 10, 2, 0);
168 commit;
169
170 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 LIMIT 10;
171 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t1 ORDER BY col1 DESC LIMIT 10;
172
173 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 LIMIT 10;
174 SELECT col1, col2, col3, SUBSTRING(col4, 1000, 32) FROM t2 ORDER BY col1 DESC LIMIT 10;
175
176 #Cleanup
177 --let restart_parameters="restart:"
178 --source include/restart_mysqld.inc
179
180 --source ../include/drop_schema.inc
181
182 DROP TABLESPACE tbs1;
183
184 UNINSTALL PLUGIN clone;
185 SET DEBUG_SYNC = 'RESET';
186
187 --source include/wait_until_count_sessions.inc
188 --force-rmdir $CLONE_DATADIR