Skip to content

Commit 7cf97ed

Browse files
committed
MDEV-11816 Disallow CREATE TEMPORARY TABLE…ROW_FORMAT=COMPRESSED
MySQL 5.7 allows temporary tables to be created in ROW_FORMAT=COMPRESSED. The usefulness of this is questionable. WL#7899 in MySQL 8.0.0 prevents the creation of such compressed tables, so that all InnoDB temporary tables will be located inside the predefined InnoDB temporary tablespace. Pick up and adjust some tests from MySQL 5.7 and 8.0. dict_tf_to_fsp_flags(): Remove the parameter is_temp. fsp_flags_init(): Remove the parameter is_temporary. row_mysql_drop_temp_tables(): Remove. There cannot be any temporary tables in InnoDB. (This never removed #sql* tables in the datadir which were created by DDL.) dict_table_t::dir_path_of_temp_table: Remove. create_table_info_t::m_temp_path: Remove. create_table_info_t::create_options_are_invalid(): Do not allow ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE for temporary tables. create_table_info_t::innobase_table_flags(): Do not unnecessarily prevent CREATE TEMPORARY TABLE with SPATIAL INDEX. (MySQL 5.7 does allow this.) fil_space_belongs_in_lru(): The only FIL_TYPE_TEMPORARY tablespace is never subjected to closing least-recently-used files.
1 parent 494e4b9 commit 7cf97ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1922
-3882
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
delimiter |;
2+
create procedure populate_t1()
3+
begin
4+
declare i int default 1;
5+
while (i <= 200) do
6+
insert into t1 values (i, 'a', 'b');
7+
set i = i + 1;
8+
end while;
9+
end|
10+
create procedure populate_t1_small()
11+
begin
12+
declare i int default 1;
13+
while (i <= 20) do
14+
insert into t1 values (i, 'c', 'd');
15+
set i = i + 1;
16+
end while;
17+
end|
18+
create procedure populate_t1_small2()
19+
begin
20+
declare i int default 30;
21+
while (i <= 50) do
22+
insert into t1 values (i, 'e', 'f');
23+
set i = i + 1;
24+
end while;
25+
end|
26+
delimiter ;|
27+
#
28+
begin;
29+
select count(*) from t1;
30+
call populate_t1();
31+
select count(*) from t1;
32+
select * from t1 limit 10;
33+
rollback;
34+
select count(*) from t1;
35+
#
36+
begin;
37+
call populate_t1();
38+
select count(*) from t1;
39+
commit;
40+
select count(*) from t1;
41+
#
42+
truncate table t1;
43+
select count(*) from t1;
44+
#
45+
call populate_t1_small();
46+
select count(*) from t1;
47+
rollback;
48+
select count(*) from t1;
49+
truncate table t1;
50+
#
51+
call populate_t1();
52+
select count(*) from t1;
53+
delete from t1 where keyc <= 60;
54+
select count(*) from t1;
55+
call populate_t1_small();
56+
select count(*) from t1;
57+
select * from t1 limit 10;
58+
begin;
59+
call populate_t1_small2();
60+
select count(*) from t1;
61+
select * from t1 where keyc > 30 limit 10;
62+
rollback;
63+
select count(*) from t1;
64+
select * from t1 where keyc > 30 limit 10;
65+
#
66+
update t1 set keyc = keyc + 2000;
67+
select * from t1 limit 10;
68+
rollback;
69+
begin;
70+
update t1 set keyc = keyc + 2000;
71+
select * from t1 limit 10;
72+
rollback;
73+
select * from t1 limit 10;
74+
commit;
75+
select * from t1 limit 10;
76+
#
77+
insert into t2 select * from t1 where keyc < 2101;
78+
select count(*) from t2;
79+
#
80+
drop procedure populate_t1;
81+
drop procedure populate_t1_small;
82+
drop procedure populate_t1_small2;

mysql-test/suite/innodb_zip/r/wl6470_1.result renamed to mysql-test/suite/innodb/r/temp_table.result

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,22 @@ count(*)
194194
drop procedure populate_t1;
195195
drop procedure populate_t1_small;
196196
drop procedure populate_t1_small2;
197-
drop table t1;
198-
drop table t2;
197+
drop temporary table t1,t2;
199198
create temporary table t1
200199
(keyc int, c1 char(100), c2 char(100),
201200
primary key(keyc), index sec_index(c1)
202201
) engine = innodb key_block_size = 4;
202+
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
203+
create temporary table t1
204+
(keyc int, c1 char(100), c2 char(100),
205+
primary key(keyc), index sec_index(c1)
206+
) engine = innodb;
203207
set innodb_strict_mode=off;
204208
create temporary table t2
205209
(keyc int, c1 char(100), c2 char(100),
206210
primary key(keyc), index sec_index(c1)
207211
) engine = innodb key_block_size = 8;
208-
set innodb_strict_mode=default;
212+
set innodb_strict_mode=on;
209213
create procedure populate_t1()
210214
begin
211215
declare i int default 1;
@@ -394,9 +398,7 @@ count(*)
394398
drop procedure populate_t1;
395399
drop procedure populate_t1_small;
396400
drop procedure populate_t1_small2;
397-
drop table t1;
398-
drop table t2;
399-
set global innodb_file_per_table = 0;
401+
drop temporary table t1, t2;
400402
create temporary table t1
401403
(keyc int, c1 char(100), c2 char(100),
402404
primary key(keyc), index sec_index(c1)
@@ -593,6 +595,3 @@ count(*)
593595
drop procedure populate_t1;
594596
drop procedure populate_t1_small;
595597
drop procedure populate_t1_small2;
596-
drop table t1;
597-
drop table t2;
598-
set global innodb_file_per_table = 1;

0 commit comments

Comments
 (0)