Skip to content

Commit

Permalink
MDEV-11816 Disallow CREATE TEMPORARY TABLE…ROW_FORMAT=COMPRESSED
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Jan 18, 2017
1 parent 494e4b9 commit 7cf97ed
Show file tree
Hide file tree
Showing 42 changed files with 1,922 additions and 3,882 deletions.
82 changes: 82 additions & 0 deletions mysql-test/suite/innodb/include/dml_ops.inc
@@ -0,0 +1,82 @@
delimiter |;
create procedure populate_t1()
begin
declare i int default 1;
while (i <= 200) do
insert into t1 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
create procedure populate_t1_small()
begin
declare i int default 1;
while (i <= 20) do
insert into t1 values (i, 'c', 'd');
set i = i + 1;
end while;
end|
create procedure populate_t1_small2()
begin
declare i int default 30;
while (i <= 50) do
insert into t1 values (i, 'e', 'f');
set i = i + 1;
end while;
end|
delimiter ;|
#
begin;
select count(*) from t1;
call populate_t1();
select count(*) from t1;
select * from t1 limit 10;
rollback;
select count(*) from t1;
#
begin;
call populate_t1();
select count(*) from t1;
commit;
select count(*) from t1;
#
truncate table t1;
select count(*) from t1;
#
call populate_t1_small();
select count(*) from t1;
rollback;
select count(*) from t1;
truncate table t1;
#
call populate_t1();
select count(*) from t1;
delete from t1 where keyc <= 60;
select count(*) from t1;
call populate_t1_small();
select count(*) from t1;
select * from t1 limit 10;
begin;
call populate_t1_small2();
select count(*) from t1;
select * from t1 where keyc > 30 limit 10;
rollback;
select count(*) from t1;
select * from t1 where keyc > 30 limit 10;
#
update t1 set keyc = keyc + 2000;
select * from t1 limit 10;
rollback;
begin;
update t1 set keyc = keyc + 2000;
select * from t1 limit 10;
rollback;
select * from t1 limit 10;
commit;
select * from t1 limit 10;
#
insert into t2 select * from t1 where keyc < 2101;
select count(*) from t2;
#
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
Expand Up @@ -194,18 +194,22 @@ count(*)
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
drop table t1;
drop table t2;
drop temporary table t1,t2;
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 4;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb;
set innodb_strict_mode=off;
create temporary table t2
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 8;
set innodb_strict_mode=default;
set innodb_strict_mode=on;
create procedure populate_t1()
begin
declare i int default 1;
Expand Down Expand Up @@ -394,9 +398,7 @@ count(*)
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
drop table t1;
drop table t2;
set global innodb_file_per_table = 0;
drop temporary table t1, t2;
create temporary table t1
(keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1)
Expand Down Expand Up @@ -593,6 +595,3 @@ count(*)
drop procedure populate_t1;
drop procedure populate_t1_small;
drop procedure populate_t1_small2;
drop table t1;
drop table t2;
set global innodb_file_per_table = 1;

0 comments on commit 7cf97ed

Please sign in to comment.