summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb_zip/t/wl6560.test
blob: 55d367479382d1aad8fc91036f4c2d840385029b (plain)
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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
#
# WL#6560: InnoDB: separate tablespace for innodb-temp-tables.
#

--source include/have_innodb.inc
--source include/have_innodb_zip.inc
# Embedded server does not restart of server
--source include/not_embedded.inc
-- source include/big_test.inc

--disable_query_log
call mtr.add_suppression("Tablespace innodb_temporary ran out of space. Please add another file or use 'autoextend' for the last file in setting innodb_temp_data_file_path.");
call mtr.add_suppression("The table 't1' is full");
--enable_query_log

################################################################################
#
# Will test following scenarios:
# 1.  creation of shared temp-tablespace.
# 2.  ddl + dml operation involving temp-tablespace.
#     insert/delete/update/select
#     create/drop/alter/truncate/import-discard (though blocked).
# 3.  ddl + dml operation on compressed table.
#     (table doesn't reside in shared temp-tablespace).
# 4.  Test bulk-loading that result in auto-extension of temp-tablespace.
# 5.  re-creation of temp-tablespace on re-start.
#     also to ensure non-existence of existing temp-table.
# 6.  restart server in innodb-read-only mode. this will also
#     block creation of temp-tables.
# 7.  try starting server with shared and temp-tablespace filename same.
# 8.  try re-starting server with param so that temp-tablespace can't be
#     expanded and insert enough data to make it full.
# 9.  tests for different row format types and key block sizes for
#     compressed tables.
# 10. try restarting server with raw device specified for temp-tablespace.
# 11. try restarting server with temp-tablespace less than min. threshold
# 12. no file specified for temp-tablespace.
################################################################################

#-----------------------------------------------------------------------------
#
# create test-bed
#
let $per_table = `select @@innodb_file_per_table`;

set global innodb_file_per_table = off;
let $MYSQL_TMP_DIR = `select @@tmpdir`;
let $MYSQL_DATA_DIR = `select @@datadir`;
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err;
let $args = --loose-console --core-file > $SEARCH_FILE 2>&1;
let crash = --loose-console > $SEARCH_FILE 2>&1 --innodb-force-recovery-crash;
let readonly = $args --innodb_read_only;
let nameconflicts = $args --innodb_data_file_path="ibdata1:12M:autoextend:max:134217728" --innodb_temp_data_file_path="ibdata1:12M:autoextend";
let rawdevice1 = $args --innodb_temp_data_file_path="/dev/hdd1:3Gnewraw;/dev/hdd2:2Gnewraw";
let rawdevice2 = $args --innodb_temp_data_file_path="/dev/hdd1:3Graw;/dev/hdd2:2Graw";
let sizeoftempfile1 = $args --innodb_temp_data_file_path="ibtmp1:2M:autoextend";
let sizeoftempfile2 = $args --innodb_data_file_path="ibdata1:2M:autoextend";
let notemptablespacefile = $args --innodb_temp_data_file_path="";

#-----------------------------------------------------------------------------
#
# 1. creation of shared temp-tablespace.
#
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*


#-----------------------------------------------------------------------------
#
# 2. ddl + dml operation involving temp-tablespace.
#    insert/delete/update/select
#    create/drop/alter/truncate/import-discard (though blocked).
#
select @@global.innodb_file_per_table;
create temporary table t1 (i int, f float, c char(100)) engine=innodb;
#
--source suite/innodb_zip/include/innodb_temp_table_dml.inc
#
# alter table
--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
alter table t1 discard tablespace;
--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
alter table t1 import tablespace;
#
# drop table
drop table t1;

#-----------------------------------------------------------------------------
#
# 3. ddl + dml operation on compressed table.
#    (table doesn't reside in shared temp-tablespace).
#
--echo #files in MYSQL_TMP_DIR
--list_files $MYSQL_TMP_DIR/ *.ibd
set global innodb_file_per_table = 1;
select @@global.innodb_file_per_table;
create temporary table t1
	(i int, f float, c char(100)) engine = innodb key_block_size = 4;
show create table t1;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
#
--source suite/innodb_zip/include/innodb_temp_table_dml.inc
#
# alter table
--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
alter table t1 discard tablespace;
#
# drop table
drop table t1;
set global innodb_file_per_table = off;

#-----------------------------------------------------------------------------
#
# 4. Test bulk-loading that result in auto-extension of temp-tablespace.
#
create temporary table t1
	(keyc int, c1 char(100), c2 char(100),
	 primary key(keyc)) engine = innodb;
delimiter |;
CREATE PROCEDURE populate_t1()
BEGIN
	DECLARE i INT DEFAULT 1;
	while (i <= 20000) DO
		insert into t1 values (i, 'a', 'b');
		SET i = i + 1;
	END WHILE;
END|
delimiter ;|
set autocommit=0;
select count(*) from t1;
call populate_t1();
select count(*) from t1;
select * from t1 limit 10;
set autocommit=1;
truncate table t1;
select count(*) from t1;
#
drop procedure populate_t1;
drop table t1;

#-----------------------------------------------------------------------------
#
# 5. re-creation of temp-tablespace on re-start.
#    also to ensure non-existence of existing temp-table.
#
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
insert into t1 values (1, 'c', 'b');
select * from t1;
#
--source include/restart_mysqld.inc
#
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*
use test;
--error ER_NO_SUCH_TABLE
select * from t1;

#-----------------------------------------------------------------------------
#
# 6. restart server in innodb-read-only mode. this will also
#    block creation of temp-tables.
#
#
--echo "testing temp-table creation in --innodb_read_only mode"
let $restart_parameters=--innodb-read-only;
--source include/restart_mysqld.inc
#
use test;
show tables;
--error ER_INNODB_READ_ONLY, 1005
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;

#-----------------------------------------------------------------------------
#
# 7. try starting server with shared and temp-tablespace filename same.
#
--source include/shutdown_mysqld.inc
--echo "testing system and temp tablespace name conflict"
--error 1
--exec $MYSQLD_CMD $nameconflicts
let SEARCH_PATTERN = innodb_temporary and innodb_system file names seem to be the same;
--source ./include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo "restarting server in normal mode"
--enable_reconnect
let $restart_parameters = restart;
--source include/start_mysqld.inc
#
show tables;
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
drop table t1;

#-----------------------------------------------------------------------------
#
# 8. try re-starting server with param so that temp-tablespace can't be expanded
#    and insert enough data to make it full.
#
--echo # test condition of full-temp-tablespace
let $restart_parameters=--innodb_temp_data_file_path=ibtmp1:12M;
--source include/restart_mysqld.inc
#
create temporary table t1
	(keyc int, c1 char(100), c2 char(100),
	 primary key(keyc)) engine = innodb;
delimiter |;
CREATE PROCEDURE populate_t1()
BEGIN
	DECLARE i INT DEFAULT 1;
	while (i <= 20000) DO
		insert into t1 values (i, 'a', 'b');
		SET i = i + 1;
	END WHILE;
END|
delimiter ;|
set autocommit=0;
select count(*) from t1;
--error ER_RECORD_FILE_FULL
call populate_t1();
#
drop procedure populate_t1;
drop table t1;

#-----------------------------------------------------------------------------
#
# 9. tests for different row format types and key block sizes for
#     compressed tables.
#
set innodb_strict_mode = off;
--disable_warnings
set global innodb_file_per_table = 0;
set global innodb_file_format = 'Antelope';
create temporary table t (
	i int)
	engine = innodb row_format = compressed;
--replace_regex /[0-9]+/NUMBER/
show warnings;
drop table t;
#
create temporary table t (
	i int)
	engine = innodb row_format = compressed key_block_size = 8;
--replace_regex /[0-9]+/NUMBER/
show warnings;
#
drop table t;
set global innodb_file_per_table = 1;
create temporary table t (
	i int)
	engine = innodb row_format = compressed key_block_size = 8;
--replace_regex /[0-9]+/NUMBER/
show warnings;
drop table t;
#
create temporary table t (
	i int)
	engine = innodb row_format = dynamic;
--replace_regex /[0-9]+/NUMBER/
show warnings;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
drop table t;
#
set innodb_strict_mode = on;
create temporary table t (
	i int)
	engine = innodb row_format = dynamic;
--replace_regex /[0-9]+/NUMBER/
drop table t;
#
set global innodb_file_format = 'Barracuda';
set innodb_strict_mode = off;
create temporary table t (
	i int)
	engine = innodb row_format = compressed key_block_size = 8;
--replace_regex /[0-9]+/NUMBER/
# explicitly disabling it else it will generate warning of ignoring
# key_block_size when suite is run with innodb-page-size=4k
#show warnings;
set innodb_strict_mode = default;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
#
drop table t;
create temporary table t (
	i int)
	engine = innodb row_format = compressed;
--replace_regex /[0-9]+/NUMBER/
show warnings;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
drop table t;
#
create temporary table t (
	i int)
	engine = innodb row_format = dynamic;
--replace_regex /[0-9]+/NUMBER/
show warnings;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
drop table t;
#
set innodb_strict_mode = on;
create temporary table t (
	i int)
	engine = innodb row_format = dynamic;
--replace_regex /[0-9]+/NUMBER/
show warnings;
drop table t;
set innodb_strict_mode = off;
#
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
create temporary table t (
	i int)
	engine = innodb row_format = dynamic key_block_size = 4;
--replace_regex /[0-9]+/NUMBER/
show warnings;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
drop table t;
#
create temporary table t (
	i int)
	engine = innodb row_format = compact;
--replace_regex /[0-9]+/NUMBER/
show warnings;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
drop table t;
#
create temporary table t (
	i int)
	engine = innodb key_block_size = 4;
--replace_regex /[0-9]+/NUMBER/
show warnings;
--echo #files in MYSQL_TMP_DIR
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
--list_files $MYSQL_TMP_DIR/ *.ibd
drop table t;
#

#-----------------------------------------------------------------------------
#
# 10. try restarting server with raw device specified for temp-tablespace.
#
--source include/shutdown_mysqld.inc
--echo "testing temp tablespace non-support for raw device"
--error 1
--exec $MYSQLD_CMD $rawdevice1
let SEARCH_PATTERN = support raw device;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo "testing temp tablespace non-support for raw device"
--error 1
--exec $MYSQLD_CMD $rawdevice2
let SEARCH_PATTERN = support raw device;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--source include/start_mysqld.inc

show tables;
create temporary table t1 (
	keyc int, c1 char(100), c2 char(100)
	) engine = innodb;
drop table t1;

#-----------------------------------------------------------------------------
#
# 11. try restarting server with temp-tablespace less than min. threshold
#
--source include/shutdown_mysqld.inc
--echo "try starting server with temp-tablespace size < min. threshold"
--error 1
--exec $MYSQLD_CMD $sizeoftempfile1
let SEARCH_PATTERN = Tablespace size must be at least;
--source ./include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo "try starting server with sys-tablespace size < min. threshold"
--error 1
--exec $MYSQLD_CMD $sizeoftempfile2
let SEARCH_PATTERN = Tablespace size must be at least;
--source ./include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--source include/start_mysqld.inc

show tables;
create temporary table t1 (
	keyc int, c1 char(100), c2 char(100)
	) engine = innodb;
drop table t1;

#-----------------------------------------------------------------------------
#
# 12. no file specified for temp-tablespace.
#
--source include/shutdown_mysqld.inc

--echo "try starting server with no file specified for temp-tablespace"
--error 1
--exec $MYSQLD_CMD $notemptablespacefile
let SEARCH_PATTERN = init function returned error;
--source ./include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--source include/start_mysqld.inc

show tables;
create temporary table t1 (
	keyc int, c1 char(100), c2 char(100)
	) engine = innodb;
drop table t1;