From 7cf97ed4ee93f7df6d021ad54b9f09964a943c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Jan 2017 11:37:49 +0200 Subject: [PATCH] =?UTF-8?q?MDEV-11816=20Disallow=20CREATE=20TEMPORARY=20TA?= =?UTF-8?q?BLE=E2=80=A6ROW=5FFORMAT=3DCOMPRESSED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- mysql-test/suite/innodb/include/dml_ops.inc | 82 + .../r/temp_table.result} | 17 +- .../r/temp_table_savepoint.result} | 173 +- .../suite/innodb/r/temporary_table.result | 639 +++++ .../r/temporary_table_optimization.result | 266 +++ .../t/temp_table.test} | 30 +- .../t/temp_table_savepoint.test} | 193 +- .../suite/innodb/t/temporary_table.test | 445 ++++ .../innodb/t/temporary_table_optimization.opt | 1 + .../t/temporary_table_optimization.test | 243 ++ .../include/innodb_temp_table_dml.inc | 40 - .../suite/innodb_zip/r/wl6501_scale_1.result | 268 +-- mysql-test/suite/innodb_zip/r/wl6915_1.result | 2079 ----------------- mysql-test/suite/innodb_zip/t/disabled.def | 14 - .../suite/innodb_zip/t/wl6501_scale_1.test | 4 - mysql-test/suite/innodb_zip/t/wl6560.test | 422 ---- mysql-test/suite/innodb_zip/t/wl6915_1.test | 650 ------ sql/share/errmsg-utf8.txt | 2 + storage/innobase/btr/btr0btr.cc | 3 +- storage/innobase/btr/btr0cur.cc | 23 +- storage/innobase/dict/dict0crea.cc | 17 +- storage/innobase/dict/dict0dict.cc | 18 +- storage/innobase/dict/dict0load.cc | 17 +- storage/innobase/fil/fil0fil.cc | 40 +- storage/innobase/fsp/fsp0file.cc | 5 +- storage/innobase/handler/ha_innodb.cc | 117 +- storage/innobase/handler/ha_innodb.h | 10 +- storage/innobase/handler/ha_innopart.cc | 4 - storage/innobase/handler/handler0alter.cc | 1 - storage/innobase/include/dict0dict.h | 5 +- storage/innobase/include/dict0mem.h | 6 - storage/innobase/include/fil0fil.h | 8 +- storage/innobase/include/fsp0fsp.h | 5 +- storage/innobase/include/fsp0fsp.ic | 7 - storage/innobase/include/row0mysql.h | 5 - storage/innobase/log/log0recv.cc | 2 - storage/innobase/page/page0page.cc | 1 + storage/innobase/page/page0zip.cc | 6 +- storage/innobase/row/row0import.cc | 2 +- storage/innobase/row/row0mysql.cc | 137 +- storage/innobase/row/row0trunc.cc | 7 +- storage/innobase/srv/srv0start.cc | 2 +- 42 files changed, 2028 insertions(+), 3988 deletions(-) create mode 100644 mysql-test/suite/innodb/include/dml_ops.inc rename mysql-test/suite/{innodb_zip/r/wl6470_1.result => innodb/r/temp_table.result} (96%) rename mysql-test/suite/{innodb_zip/r/wl6470_2.result => innodb/r/temp_table_savepoint.result} (73%) create mode 100644 mysql-test/suite/innodb/r/temporary_table.result create mode 100644 mysql-test/suite/innodb/r/temporary_table_optimization.result rename mysql-test/suite/{innodb_zip/t/wl6470_1.test => innodb/t/temp_table.test} (74%) rename mysql-test/suite/{innodb_zip/t/wl6470_2.test => innodb/t/temp_table_savepoint.test} (67%) create mode 100644 mysql-test/suite/innodb/t/temporary_table.test create mode 100644 mysql-test/suite/innodb/t/temporary_table_optimization.opt create mode 100644 mysql-test/suite/innodb/t/temporary_table_optimization.test delete mode 100644 mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc delete mode 100644 mysql-test/suite/innodb_zip/r/wl6915_1.result delete mode 100644 mysql-test/suite/innodb_zip/t/disabled.def delete mode 100644 mysql-test/suite/innodb_zip/t/wl6560.test delete mode 100644 mysql-test/suite/innodb_zip/t/wl6915_1.test diff --git a/mysql-test/suite/innodb/include/dml_ops.inc b/mysql-test/suite/innodb/include/dml_ops.inc new file mode 100644 index 00000000000..4908dfb6bee --- /dev/null +++ b/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; diff --git a/mysql-test/suite/innodb_zip/r/wl6470_1.result b/mysql-test/suite/innodb/r/temp_table.result similarity index 96% rename from mysql-test/suite/innodb_zip/r/wl6470_1.result rename to mysql-test/suite/innodb/r/temp_table.result index ea1866d69eb..e90da0d5e77 100644 --- a/mysql-test/suite/innodb_zip/r/wl6470_1.result +++ b/mysql-test/suite/innodb/r/temp_table.result @@ -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; @@ -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) @@ -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; diff --git a/mysql-test/suite/innodb_zip/r/wl6470_2.result b/mysql-test/suite/innodb/r/temp_table_savepoint.result similarity index 73% rename from mysql-test/suite/innodb_zip/r/wl6470_2.result rename to mysql-test/suite/innodb/r/temp_table_savepoint.result index b001cd73882..d61eef404da 100644 --- a/mysql-test/suite/innodb_zip/r/wl6470_2.result +++ b/mysql-test/suite/innodb/r/temp_table_savepoint.result @@ -2,8 +2,6 @@ create procedure populate_tables() begin declare n int default 20; declare inner_loop int default 100; -set global innodb_file_per_table=on; -drop table if exists t1,t2,t3,t4; create temporary table t1(c1 int not null, c2 int not null, c3 char(255) not null, @@ -14,7 +12,7 @@ c7 varchar(2000) not null, c8 datetime, c9 decimal(6,3), primary key (c1), -index (c3,c4(50),c5(50)), +index (c3,c4(50),c5(50)), index (c2)) engine=innodb row_format=redundant; create temporary table t2(c1 int not null, @@ -30,19 +28,6 @@ primary key (c1), index (c3,c4(50),c5(50)), index (c2)) engine=innodb row_format=compact; -create temporary table t3(c1 int not null, -c2 int not null, -c3 char(255) not null, -c4 text(6000) not null, -c5 blob(6000) not null, -c6 varchar(2000) not null, -c7 varchar(2000) not null, -c8 datetime, -c9 decimal(6,3), -primary key (c1), -index (c3,c4(50),c5(50)), -index (c2)) -engine=innodb row_format=compressed key_block_size=4; create temporary table t4(c1 int not null, c2 int not null, c3 char(255) not null, @@ -74,16 +59,12 @@ insert into t6 values (50),(100),(150),(190); while (n > 0) do start transaction; insert into t1 values(n,n,repeat(concat(' tc3_',n),30), -repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), -repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), +repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8), +repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8), now(),(100.55+n)); insert into t2 values(n,n,repeat(concat(' tc3_',n),30), -repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), -repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), -now(),(100.55+n)); -insert into t3 values(n,n,repeat(concat(' tc3_',n),30), -repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), -repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), +repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8), +repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8), now(),(100.55+n)); insert into t4 values(n,n,repeat(concat(' tc3_',n),30), repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), @@ -95,33 +76,27 @@ repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), now(),(100.55+n)); if (n > 10) then commit; -else +else delete from t1 where c1 > 10 ; delete from t2 where c1 > 10 ; -delete from t3 where c1 > 10 ; delete from t4 where c1 > 10 ; delete from t5 where c1 > 10 ; rollback; start transaction; update t1 set c1 = c1 + 1000 where c1 > 10; update t2 set c1 = c1 + 1000 where c1 > 10; -update t3 set c1 = c1 + 1000 where c1 > 10; update t4 set c1 = c1 + 1000 where c1 > 10; update t5 set c1 = c1 + 1000 where c1 > 10; rollback; -end if; +end if; start transaction; insert into t1 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), +repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t2 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), -now(),(100.55+n+inner_loop)); -insert into t3 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), +repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t4 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), @@ -133,26 +108,20 @@ repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245 now(),(100.55+n+inner_loop)); delete from t1 where c1 between 100 and 110; delete from t2 where c1 between 100 and 110; -delete from t3 where c1 between 100 and 110; delete from t4 where c1 between 100 and 110; delete from t5 where c1 between 100 and 110; -update t1 set c1 = c1+1 where c1>110; -update t2 set c1 = c1+1 where c1>110; -update t3 set c1 = c1+1 where c1>110; -update t4 set c1 = c1+1 where c1>110; -update t5 set c1 = c1+1 where c1>110; +update t1 set c1 = c1+1 where c1>110; +update t2 set c1 = c1+1 where c1>110; +update t4 set c1 = c1+1 where c1>110; +update t5 set c1 = c1+1 where c1>110; savepoint a; insert into t1 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), +repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t2 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), -now(),(100.55+n+inner_loop)); -insert into t3 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), +repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t4 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), @@ -164,16 +133,12 @@ repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245 now(),(100.55+n+inner_loop)); savepoint b; insert into t1 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), +repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t2 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), -now(),(100.55+n+inner_loop)); -insert into t3 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), -repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), -repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), +repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), +repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t4 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), @@ -189,16 +154,13 @@ rollback to a; commit; commit; rollback; -set n = n - 1; +set n = n - 1; end while; end| connect con1,localhost,root,,; +call populate_tables();; connect con2,localhost,root,,; -#---client 1 : dml operation ---" -connection con1; -#---client 2 : dml operation ---" -connection con2; -# In connection 1 +call populate_tables();; connection con1; select count(*) from t1; count(*) @@ -206,9 +168,6 @@ count(*) select count(*) from t2; count(*) 20 -select count(*) from t3; -count(*) -20 select count(*) from t4; count(*) 20 @@ -259,28 +218,6 @@ c1 136 138 140 -select c1 from t3; -c1 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 select c1 from t4; c1 11 @@ -325,7 +262,6 @@ c1 136 138 140 -# In connection 2 connection con2; select count(*) from t1; count(*) @@ -333,9 +269,6 @@ count(*) select count(*) from t2; count(*) 20 -select count(*) from t3; -count(*) -20 select count(*) from t4; count(*) 20 @@ -386,28 +319,6 @@ c1 136 138 140 -select c1 from t3; -c1 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 select c1 from t4; c1 11 @@ -452,7 +363,6 @@ c1 136 138 140 -# In connection 1 connection con1; set autocommit = 0; insert into t1 values (20,1,'a','a','a','a','a',now(),100.55); @@ -465,11 +375,6 @@ ERROR 23000: Duplicate entry '20' for key 'PRIMARY' insert ignore into t2 values (20,1,'a','a','a','a','a',now(),100.55); Warnings: Warning 1062 Duplicate entry '20' for key 'PRIMARY' -insert into t3 values (20,1,'a','a','a','a','a',now(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -insert ignore into t3 values (20,1,'a','a','a','a','a',now(),100.55); -Warnings: -Warning 1062 Duplicate entry '20' for key 'PRIMARY' insert into t4 values (20,1,'a','a','a','a','a',now(),100.55); ERROR 23000: Duplicate entry '20' for key 'PRIMARY' insert ignore into t4 values (20,1,'a','a','a','a','a',now(),100.55); @@ -486,9 +391,6 @@ ERROR 23000: Duplicate entry '20' for key 'PRIMARY' insert into t2 values (1,1,'a','a','a','a','a',now(),100.55), (20,1,'a','a','a','a','a',now(),100.55); ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -insert into t3 values (1,1,'a','a','a','a','a',now(),100.55), -(20,1,'a','a','a','a','a',now(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' insert into t4 values (1,1,'a','a','a','a','a',now(),100.55), (20,1,'a','a','a','a','a',now(),100.55); ERROR 23000: Duplicate entry '20' for key 'PRIMARY' @@ -502,9 +404,6 @@ c1 c2 select c1,c2 from t2 where c1 in (20,1); c1 c2 20 20 -select c1,c2 from t3 where c1 in (20,1); -c1 c2 -20 20 select c1,c2 from t4 where c1 in (20,1); c1 c2 20 20 @@ -513,7 +412,6 @@ c1 c2 20 20 replace into t1 values (20,1,'a','a','a','a','a',now(),100.55); replace into t2 values (20,1,'a','a','a','a','a',now(),100.55); -replace into t3 values (20,1,'a','a','a','a','a',now(),100.55); replace into t4 values (20,1,'a','a','a','a','a',now(),100.55); replace into t5 values (20,1,'a','a','a','a','a',now(),100.55); select c1,c2,c3,c4,c5,c6,c7,c9 from t1 where c1 = 20; @@ -522,9 +420,6 @@ c1 c2 c3 c4 c5 c6 c7 c9 select c1,c2,c3,c4,c5,c6,c7,c9 from t2 where c1 = 20; c1 c2 c3 c4 c5 c6 c7 c9 20 1 a a a a a 100.550 -select c1,c2,c3,c4,c5,c6,c7,c9 from t3 where c1 = 20; -c1 c2 c3 c4 c5 c6 c7 c9 -20 1 a a a a a 100.550 select c1,c2,c3,c4,c5,c6,c7,c9 from t4 where c1 = 20; c1 c2 c3 c4 c5 c6 c7 c9 20 1 a a a a a 100.550 @@ -533,7 +428,6 @@ c1 c2 c3 c4 c5 c6 c7 c9 20 1 a a a a a 100.550 update ignore t1 set c1 = 20 where c1 = 140 ; update ignore t2 set c1 = 20 where c1 = 140 ; -update ignore t3 set c1 = 20 where c1 = 140 ; update ignore t4 set c1 = 20 where c1 = 140 ; update ignore t5 set c1 = 20 where c1 = 140 ; select count(*) from t1 where c1 = 140; @@ -542,25 +436,22 @@ count(*) select count(*) from t2 where c1 = 140; count(*) 1 -select count(*) from t3 where c1 = 140; -count(*) -1 select count(*) from t4 where c1 = 140; count(*) 1 select count(*) from t5 where c1 = 140; count(*) 1 -"running select * into outfile from t1 ; +select * into outfile "VARDIR/tmp/t1.outfile" from t1; create temporary table temp_1 engine = innodb as select * from t1 where 1=2; select count(*) from temp_1; count(*) 0 -"running load data infile into temp_1 ; +load data infile 'VARDIR/tmp/t1.outfile' into table temp_1; select count(*) from temp_1; count(*) 20 -alter table temp_1 add column c10 int default 99 , +alter table temp_1 add column c10 int default 99 , add column c11 varchar(100) default 'test'; alter table temp_1 add primary key (c1); insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55); @@ -570,15 +461,12 @@ c1 c2 c3 c4 c5 c6 c7 c9 c10 c11 select count(*) from temp_1 where c10 = 99 and c11 like 'test'; count(*) 21 -insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55) +insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55) on duplicate key update c1=-2,c2=-2; select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0; c1 c2 c3 c4 c5 c6 c7 c9 c10 c11 -2 -2 a a a a a 100.550 99 test -drop table t1 ,t2 ,t3,t4,t5,t6,temp_1; disconnect con1; -connection con2; -drop table t1 ,t2 ,t3,t4,t5,t6; disconnect con2; connection default; drop procedure populate_tables; @@ -664,4 +552,3 @@ count(*) drop prepare stm; drop prepare stm_1; drop prepare stm_2; -drop table prep_1; diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result new file mode 100644 index 00000000000..1fb73f4e775 --- /dev/null +++ b/mysql-test/suite/innodb/r/temporary_table.result @@ -0,0 +1,639 @@ +# files in MYSQL_DATA_DIR +ibtmp1 +create temporary table t1 (i int, f float, c char(100)) engine=innodb; +insert into t1 values (100, 1.1, 'pune'); +insert into t1 values (99, 1.2, 'mumbai'); +insert into t1 values (98, 1.3, 'jaipur'); +insert into t1 values (97, 1.4, 'delhi'); +insert into t1 values (96, 1.5, 'ahmedabad'); +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +select * from t1 where i = 98; +i f c +98 1.3 jaipur +select * from t1 where i < 100; +i f c +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +explain select * from t1 where f > 1.29999; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +alter table t1 add index sec_index(f); +explain select * from t1 where f > 1.29999; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL sec_index NULL NULL NULL 5 Using where +select * from t1 where f > 1.29999; +i f c +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +explain select * from t1 where i = 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +alter table t1 add unique index pri_index(i); +explain select * from t1 where i = 100; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const pri_index pri_index 5 const 1 +select * from t1 where i = 100; +i f c +100 1.1 pune +delete from t1 where i < 97; +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +insert into t1 values (96, 1.5, 'kolkata'); +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 kolkata +update t1 set f = 1.44 where c = 'delhi'; +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.44 delhi +96 1.5 kolkata +truncate table t1; +insert into t1 values (100, 1.1, 'pune'); +insert into t1 values (99, 1.2, 'mumbai'); +insert into t1 values (98, 1.3, 'jaipur'); +insert into t1 values (97, 1.4, 'delhi'); +insert into t1 values (96, 1.5, 'ahmedabad'); +select * from t1; +i f c +100 1.1 pune +99 1.2 mumbai +98 1.3 jaipur +97 1.4 delhi +96 1.5 ahmedabad +alter table t1 discard tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +alter table t1 import tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +drop temporary table t1; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) engine = innodb; +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| +set autocommit=0; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +20000 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +set autocommit=1; +truncate table t1; +select * from t1; +keyc c1 c2 +# test condition of full-temp-tablespace +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) engine = innodb; +begin; +call populate_t1(); +ERROR HY000: The table 't1' is full +drop procedure populate_t1; +# test read-only mode +# files in MYSQL_DATA_DIR +ibtmp1 +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +show tables; +Tables_in_test +create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb; +ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only") +# test various bad start-up parameters +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); +ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS +create temporary table t ( +i int) +engine = innodb row_format = compressed; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +create temporary table t ( +i int) +engine = innodb row_format = compressed key_block_size = 8; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +set innodb_strict_mode = off; +create temporary table t ( +i int) +engine = innodb row_format = compressed key_block_size = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +show warnings; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +set innodb_strict_mode = default; +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = compressed; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +#files in MYSQL_TMP_DIR, expecting only default temporary tablespace file +ibtmp1 +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = dynamic; +show warnings; +Level Code Message +drop table t; +set innodb_strict_mode = off; +create temporary table t ( +i int) +engine = innodb row_format = dynamic key_block_size = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +show warnings; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +drop table t; +create temporary table t ( +i int) +engine = innodb row_format = compact; +show warnings; +Level Code Message +drop table t; +create temporary table t ( +i int) +engine = innodb key_block_size = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +show warnings; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +drop table t; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPACT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=8 +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +ALTER TABLE t1 KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 +ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4 +DROP TABLE t1; +set innodb_strict_mode = ON; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY, +c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +Level Code Message +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `c` char(10) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +DROP TABLE t1; +CREATE TEMPORARY TABLE t1 ( +i INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +ALTER TABLE t1 KEY_BLOCK_SIZE = 4; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +set innodb_strict_mode = OFF; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +set innodb_strict_mode = ON; +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC +set innodb_strict_mode = OFF; +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +ALTER TABLE t1 KEY_BLOCK_SIZE = 8; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW WARNINGS; +Level Code Message +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=8. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +set innodb_strict_mode = ON; +ALTER TABLE t1 ADD COLUMN j INT; +ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +SHOW WARNINGS; +Level Code Message +Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8 +set innodb_strict_mode = OFF; +ALTER TABLE t1 KEY_BLOCK_SIZE = 0; +Warnings: +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +set innodb_strict_mode = ON; +ALTER TABLE t1 ADD COLUMN j INT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `i` int(11) NOT NULL, + `j` int(11) DEFAULT NULL, + PRIMARY KEY (`i`) KEY_BLOCK_SIZE=8 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC diff --git a/mysql-test/suite/innodb/r/temporary_table_optimization.result b/mysql-test/suite/innodb/r/temporary_table_optimization.result new file mode 100644 index 00000000000..63c4f388bf7 --- /dev/null +++ b/mysql-test/suite/innodb/r/temporary_table_optimization.result @@ -0,0 +1,266 @@ +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +i +1 +2 +3 +4 +select * from t1 where i = 4; +i +4 +drop table t1; +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +i +1 +2 +3 +4 +select * from t1 where i = 4; +i +4 +drop table t1; +create temporary table t2 (i int) engine = innodb; +insert into t2 values (1), (2), (3), (4); +select * from t2; +i +1 +2 +3 +4 +select * from t2 where i = 4; +i +4 +drop table t2; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) engine = innodb; +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| +set autocommit=0; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +select * from t1 limit 10; +keyc c1 c2 +1 a b +2 a b +3 a b +4 a b +5 a b +6 a b +7 a b +8 a b +9 a b +10 a b +set autocommit=1; +truncate table t1; +select count(*) from t1; +count(*) +0 +drop table t1; +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +i +1 +2 +3 +4 +select * from t1 where i = 4; +i +4 +drop table t1; +create temporary table t1 +(keyc int, c1 char(100), c2 char(100), +primary key(keyc)) +engine = innodb; +begin; +select count(*) from t1; +count(*) +0 +call populate_t1(); +select count(*) from t1; +count(*) +200 +rollback; +select count(*) from t1; +count(*) +0 +begin; +call populate_t1(); +commit; +select count(*) from t1; +count(*) +200 +truncate table t1; +select count(*) from t1; +count(*) +0 +drop table t1; +drop procedure populate_t1; +create temporary table t1 (t1_i int, t1_f float) engine = innodb; +insert into t1 values (1, 1.1), (2, 2.2), (3, 2.2), (4, 4.4); +explain select * from t1 where t1_i = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where +alter table t1 add unique index pri_index(t1_i); +explain select * from t1 where t1_i = 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 const pri_index pri_index 5 const 1 +select * from t1 where t1_i = 1; +t1_i t1_f +1 1.1 +alter table t1 add unique index sec_index(t1_f); +ERROR 23000: Duplicate entry '2.2' for key 'sec_index' +alter table t1 add index sec_index(t1_f); +explain select * from t1 where t1_f > 2.2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL sec_index NULL NULL NULL 4 Using where +select * from t1 where t1_f > 2.2; +t1_i t1_f +2 2.2 +3 2.2 +4 4.4 +alter table t1 add column (t1_c char(10)); +select * from t1; +t1_i t1_f t1_c +1 1.1 NULL +2 2.2 NULL +3 2.2 NULL +4 4.4 NULL +insert into t1 values (5, 5.5, 'krunal'); +alter table t1 drop column t1_f; +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `t1_i` int(11) DEFAULT NULL, + `t1_c` char(10) DEFAULT NULL, + UNIQUE KEY `pri_index` (`t1_i`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +select * from t1 where t1_f > 2.2; +ERROR 42S22: Unknown column 't1_f' in 'where clause' +alter table t1 add index sec_index2(t1_c), algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +drop table t1; +create temporary table t1 (i int, f float) engine = innodb; +insert into t1 values (10, 1.1), (20, 2.2); +select * from t1; +i f +10 1.1 +20 2.2 +alter table t1 discard tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +alter table t1 import tablespace; +ERROR HY000: Cannot DISCARD/IMPORT tablespace associated with temporary table +drop table t1; +create temporary table t1 (i int) engine=innodb; +insert into t1 values (1), (2), (3); +select * from t1; +i +1 +2 +3 +alter table t1 rename t2; +select * from t1; +ERROR 42S02: Table 'test.t1' doesn't exist +select * from t2; +i +1 +2 +3 +insert into t2 values (1), (2), (6), (7); +select * from t2; +i +1 +2 +3 +1 +2 +6 +7 +drop table t2; +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +SET innodb_strict_mode=OFF; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = compact engine=innodb; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = compressed engine=innodb; +drop table t; +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = compact engine=innodb; +ERROR HY000: Index column size too large. The maximum column size is 767 bytes +create temporary table t ( +a int not null, +b blob not null, +index sk (b(3021)) +) row_format = dynamic engine=innodb; +drop table t; +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +CREATE TEMPORARY TABLE t2 ( i INT ) ENGINE = Innodb; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_'; +COUNT(*) +0 +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +COUNT(*) +1 +CREATE TEMPORARY table t3 ( i INT ) ENGINE = Innodb; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_'; +COUNT(*) +0 +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +COUNT(*) +1 +DROP TABLE t1,t2,t3; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_'; +COUNT(*) +0 +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +COUNT(*) +0 diff --git a/mysql-test/suite/innodb_zip/t/wl6470_1.test b/mysql-test/suite/innodb/t/temp_table.test similarity index 74% rename from mysql-test/suite/innodb_zip/t/wl6470_1.test rename to mysql-test/suite/innodb/t/temp_table.test index ecf6b601d3d..4809f278fb6 100644 --- a/mysql-test/suite/innodb_zip/t/wl6470_1.test +++ b/mysql-test/suite/innodb/t/temp_table.test @@ -1,6 +1,4 @@ --source include/have_innodb.inc ---source include/have_innodb_zip.inc ---source include/big_test.inc #################################################################### # TC to test temp-table DML optimization changes for correctness # @@ -22,28 +20,29 @@ create temporary table t2 (keyc int, c1 char(100), c2 char(100), primary key(keyc), index sec_index(c1) ) engine = innodb; ---source suite/innodb_zip/include/innodb_dml_ops.inc -drop table t1; -drop table t2; +--source suite/innodb/include/dml_ops.inc +drop temporary table t1,t2; # ---disable_warnings +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE 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; +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; +--disable_warnings 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; --enable_warnings ---source suite/innodb_zip/include/innodb_dml_ops.inc -drop table t1; -drop table t2; +--source suite/innodb/include/dml_ops.inc +drop temporary table t1, t2; # -let $file_per_table = `select @@innodb_file_per_table`; -set global innodb_file_per_table = 0; create temporary table t1 (keyc int, c1 char(100), c2 char(100), primary key(keyc), index sec_index(c1) @@ -52,9 +51,4 @@ create temporary table t2 (keyc int, c1 char(100), c2 char(100), primary key(keyc), index sec_index(c1) ) engine = innodb; ---source suite/innodb_zip/include/innodb_dml_ops.inc -drop table t1; -drop table t2; -eval set global innodb_file_per_table = $file_per_table; -# - +--source suite/innodb/include/dml_ops.inc diff --git a/mysql-test/suite/innodb_zip/t/wl6470_2.test b/mysql-test/suite/innodb/t/temp_table_savepoint.test similarity index 67% rename from mysql-test/suite/innodb_zip/t/wl6470_2.test rename to mysql-test/suite/innodb/t/temp_table_savepoint.test index 020c27b97b9..314ac148fca 100644 --- a/mysql-test/suite/innodb_zip/t/wl6470_2.test +++ b/mysql-test/suite/innodb/t/temp_table_savepoint.test @@ -1,11 +1,10 @@ --source include/have_innodb.inc ---source include/have_innodb_zip.inc --source include/no_valgrind_without_big.inc #################################################################### # TC to test temp-table DML optimization changes for correctness # # Sceanrio covered in single testcase : # -# - Tables with row format(redundant,compressed,dynamic,compact # +# - Tables with row format(redundant,dynamic,compact) # # - Table with primary,composite,prefix,secondary index # # - Insert/delete/update with transactioons # # - Transaction with commit,rollback,savepoint statements # @@ -14,37 +13,20 @@ # - Inserting data using # # - Insert into .. , Load data infile..,insert ignore # # - Insert into .. on duplicate update # -# - Check basic delete and upadte [ignore] # +# - Check basic delete and update [ignore] # # - Check constraints like duplicate key,default value # # - Alter add column , add primary key # # - with prepare and execute statement # #################################################################### -# run for page size >= 8k ---disable_warnings -if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value >= 8192`) -{ - --skip Test requires InnoDB with page size >= 8k. -} ---enable_warnings - - -# Save initial values of server variable ---disable_query_log -let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; -SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; ---enable_query_log - -# Create procedure to perform +# Create procedure to perform # 1. Create temp table with row types , index , sufficent data types -# 2. Perform DML with transaction +# 2. Perform DML with transaction delimiter |; create procedure populate_tables() begin declare n int default 20; declare inner_loop int default 100; - set global innodb_file_per_table=on; - drop table if exists t1,t2,t3,t4; create temporary table t1(c1 int not null, c2 int not null, @@ -56,7 +38,7 @@ create procedure populate_tables() c8 datetime, c9 decimal(6,3), primary key (c1), - index (c3,c4(50),c5(50)), + index (c3,c4(50),c5(50)), index (c2)) engine=innodb row_format=redundant; @@ -74,20 +56,6 @@ create procedure populate_tables() index (c2)) engine=innodb row_format=compact; - create temporary table t3(c1 int not null, - c2 int not null, - c3 char(255) not null, - c4 text(6000) not null, - c5 blob(6000) not null, - c6 varchar(2000) not null, - c7 varchar(2000) not null, - c8 datetime, - c9 decimal(6,3), - primary key (c1), - index (c3,c4(50),c5(50)), - index (c2)) - engine=innodb row_format=compressed key_block_size=4; - create temporary table t4(c1 int not null, c2 int not null, c3 char(255) not null, @@ -115,23 +83,19 @@ create procedure populate_tables() index (c3,c4(50),c5(50)), index (c2)) engine=innodb; - + create temporary table t6 ( a int ) engine = innodb; insert into t6 values (50),(100),(150),(190); while (n > 0) do start transaction; insert into t1 values(n,n,repeat(concat(' tc3_',n),30), - repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), - repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), + repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8), + repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8), now(),(100.55+n)); insert into t2 values(n,n,repeat(concat(' tc3_',n),30), - repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), - repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), - now(),(100.55+n)); - insert into t3 values(n,n,repeat(concat(' tc3_',n),30), - repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), - repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800), + repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8), + repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8), now(),(100.55+n)); insert into t4 values(n,n,repeat(concat(' tc3_',n),30), repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800), @@ -144,35 +108,29 @@ create procedure populate_tables() if (n > 10) then commit; - else + else delete from t1 where c1 > 10 ; delete from t2 where c1 > 10 ; - delete from t3 where c1 > 10 ; delete from t4 where c1 > 10 ; delete from t5 where c1 > 10 ; - + rollback; start transaction; update t1 set c1 = c1 + 1000 where c1 > 10; update t2 set c1 = c1 + 1000 where c1 > 10; - update t3 set c1 = c1 + 1000 where c1 > 10; update t4 set c1 = c1 + 1000 where c1 > 10; update t5 set c1 = c1 + 1000 where c1 > 10; rollback; - end if; + end if; start transaction; insert into t1 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), + repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), + repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t2 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), - now(),(100.55+n+inner_loop)); - insert into t3 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), + repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), + repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t4 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), @@ -185,29 +143,23 @@ create procedure populate_tables() delete from t1 where c1 between 100 and 110; delete from t2 where c1 between 100 and 110; - delete from t3 where c1 between 100 and 110; delete from t4 where c1 between 100 and 110; delete from t5 where c1 between 100 and 110; - update t1 set c1 = c1+1 where c1>110; - update t2 set c1 = c1+1 where c1>110; - update t3 set c1 = c1+1 where c1>110; - update t4 set c1 = c1+1 where c1>110; - update t5 set c1 = c1+1 where c1>110; + update t1 set c1 = c1+1 where c1>110; + update t2 set c1 = c1+1 where c1>110; + update t4 set c1 = c1+1 where c1>110; + update t5 set c1 = c1+1 where c1>110; savepoint a; insert into t1 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), + repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), + repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t2 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), - now(),(100.55+n+inner_loop)); - insert into t3 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), + repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), + repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t4 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), @@ -220,16 +172,12 @@ create procedure populate_tables() savepoint b; insert into t1 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), + repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), + repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t2 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), - now(),(100.55+n+inner_loop)); - insert into t3 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), - repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), - repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245), + repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8), + repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2), now(),(100.55+n+inner_loop)); insert into t4 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30), repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800), @@ -245,67 +193,42 @@ create procedure populate_tables() commit; commit; rollback; - set n = n - 1; + set n = n - 1; end while; end| delimiter ;| # Create two client for concurrent execution connect (con1,localhost,root,,); +--send call populate_tables(); + connect (con2,localhost,root,,); - ---echo #---client 1 : dml operation ---" -connection con1; --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; --- enable_query_log --- disable_query_log -# call procedure --send call populate_tables(); --- enable_query_log ---echo #---client 2 : dml operation ---" -connection con2; --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; --- enable_query_log --- disable_query_log -# call procedure ---send call populate_tables(); --- enable_query_log - -# check data of client connection 1 ---echo # In connection 1 connection con1; --reap -# 20 rows exepceted in 5 tables +# 20 rows expected select count(*) from t1; select count(*) from t2; -select count(*) from t3; select count(*) from t4; select count(*) from t5; select c1 from t1; select c1 from t2; -select c1 from t3; select c1 from t4; select c1 from t5; -# check data of client connection 2 ---echo # In connection 2 + connection con2; --reap -# 20 rows exepceted in 5 tables +# 20 rows expected select count(*) from t1; select count(*) from t2; -select count(*) from t3; select count(*) from t4; select count(*) from t5; select c1 from t1; select c1 from t2; -select c1 from t3; select c1 from t4; select c1 from t5; ---echo # In connection 1 connection con1; set autocommit = 0; @@ -317,9 +240,6 @@ insert ignore into t1 values (20,1,'a','a','a','a','a',now(),100.55); insert into t2 values (20,1,'a','a','a','a','a',now(),100.55); insert ignore into t2 values (20,1,'a','a','a','a','a',now(),100.55); --error ER_DUP_ENTRY -insert into t3 values (20,1,'a','a','a','a','a',now(),100.55); -insert ignore into t3 values (20,1,'a','a','a','a','a',now(),100.55); ---error ER_DUP_ENTRY insert into t4 values (20,1,'a','a','a','a','a',now(),100.55); insert ignore into t4 values (20,1,'a','a','a','a','a',now(),100.55); --error ER_DUP_ENTRY @@ -334,9 +254,6 @@ insert into t1 values (1,1,'a','a','a','a','a',now(),100.55), insert into t2 values (1,1,'a','a','a','a','a',now(),100.55), (20,1,'a','a','a','a','a',now(),100.55); --error ER_DUP_ENTRY -insert into t3 values (1,1,'a','a','a','a','a',now(),100.55), -(20,1,'a','a','a','a','a',now(),100.55); ---error ER_DUP_ENTRY insert into t4 values (1,1,'a','a','a','a','a',now(),100.55), (20,1,'a','a','a','a','a',now(),100.55); --error ER_DUP_ENTRY @@ -347,74 +264,59 @@ set autocommit = 1; select c1,c2 from t1 where c1 in (20,1); select c1,c2 from t2 where c1 in (20,1); -select c1,c2 from t3 where c1 in (20,1); select c1,c2 from t4 where c1 in (20,1); select c1,c2 from t5 where c1 in (20,1); #replace statement replace into t1 values (20,1,'a','a','a','a','a',now(),100.55); replace into t2 values (20,1,'a','a','a','a','a',now(),100.55); -replace into t3 values (20,1,'a','a','a','a','a',now(),100.55); replace into t4 values (20,1,'a','a','a','a','a',now(),100.55); replace into t5 values (20,1,'a','a','a','a','a',now(),100.55); # verify row is replaced from (20,20) to (20,1) select c1,c2,c3,c4,c5,c6,c7,c9 from t1 where c1 = 20; select c1,c2,c3,c4,c5,c6,c7,c9 from t2 where c1 = 20; -select c1,c2,c3,c4,c5,c6,c7,c9 from t3 where c1 = 20; select c1,c2,c3,c4,c5,c6,c7,c9 from t4 where c1 = 20; select c1,c2,c3,c4,c5,c6,c7,c9 from t5 where c1 = 20; -# Update ignore. statement is gonored as 20 value exits +# Update ignore. statement is ignored as 20 value exists update ignore t1 set c1 = 20 where c1 = 140 ; update ignore t2 set c1 = 20 where c1 = 140 ; -update ignore t3 set c1 = 20 where c1 = 140 ; update ignore t4 set c1 = 20 where c1 = 140 ; update ignore t5 set c1 = 20 where c1 = 140 ; # see record 140 is present as last update ignored select count(*) from t1 where c1 = 140; select count(*) from t2 where c1 = 140; -select count(*) from t3 where c1 = 140; select count(*) from t4 where c1 = 140; select count(*) from t5 where c1 = 140; -# Load data infile ---echo "running select * into outfile from t1 ; ---disable_query_log +--replace_result $MYSQLTEST_VARDIR VARDIR eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t1.outfile" from t1; ---enable_query_log -# Create table as select + create temporary table temp_1 engine = innodb as select * from t1 where 1=2; select count(*) from temp_1; ---echo "running load data infile into temp_1 ; ---disable_query_log + +--replace_result $MYSQLTEST_VARDIR VARDIR eval load data infile '$MYSQLTEST_VARDIR/tmp/t1.outfile' into table temp_1; ---enable_query_log select count(*) from temp_1; +--remove_file $MYSQLTEST_VARDIR/tmp/t1.outfile # Alter table to add column and primary key -alter table temp_1 add column c10 int default 99 , +alter table temp_1 add column c10 int default 99 , add column c11 varchar(100) default 'test'; alter table temp_1 add primary key (c1); insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55); select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0; select count(*) from temp_1 where c10 = 99 and c11 like 'test'; # insert on duplicate key update -insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55) +insert into temp_1 (c1,c2,c3,c4,c5,c6,c7,c8,c9) values (-1,-1,'a','a','a','a','a',now(),100.55) on duplicate key update c1=-2,c2=-2; select c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 from temp_1 where c1 < 0; -#cleanup -drop table t1 ,t2 ,t3,t4,t5,t6,temp_1; disconnect con1; - -connection con2; -drop table t1 ,t2 ,t3,t4,t5,t6; disconnect con2; - connection default; drop procedure populate_tables; - # case 2 - with prepare and execute let $prep_loop= 5; create temporary table prep_1(c1 int not null, @@ -457,12 +359,3 @@ select count(*) from prep_1; drop prepare stm; drop prepare stm_1; drop prepare stm_2; -drop table prep_1; - ---remove_file $MYSQLTEST_VARDIR/tmp/t1.outfile - --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; -SET sql_mode = default; --- enable_query_log - diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test new file mode 100644 index 00000000000..9f63fe52f3b --- /dev/null +++ b/mysql-test/suite/innodb/t/temporary_table.test @@ -0,0 +1,445 @@ +# +# InnoDB temporary table test case, including +# WL#6560: InnoDB: separate tablespace for innodb-temp-tables. +# WL#7899: InnoDB: Map compressed temporary tables to uncompressed +# + +--source include/have_innodb.inc +# Embedded server does not restart of server +--source include/not_embedded.inc +--source include/no_valgrind_without_big.inc + +--disable_query_log +call mtr.add_suppression("last file in setting innodb_temp_data_file_path"); +call mtr.add_suppression("The table 't1' is full"); +call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); +call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); +call mtr.add_suppression("InnoDB: Tablespace doesn't support raw devices"); +call mtr.add_suppression("InnoDB: The innodb_temporary data file 'ibtmp1' must be at least"); +call mtr.add_suppression("InnoDB: Plugin initialization aborted"); +call mtr.add_suppression("innodb_temporary and innodb_system file names seem to be the same"); +call mtr.add_suppression("Could not create the shared innodb_temporary"); +call mtr.add_suppression("InnoDB: syntax error in file path"); +--enable_query_log + +let $MYSQL_TMP_DIR = `select @@tmpdir`; +let $MYSQL_DATA_DIR = `select @@datadir`; + +--echo # files in MYSQL_DATA_DIR +--list_files $MYSQL_DATA_DIR/ ibtmp* + +create temporary table t1 (i int, f float, c char(100)) engine=innodb; +insert into t1 values (100, 1.1, 'pune'); +insert into t1 values (99, 1.2, 'mumbai'); +insert into t1 values (98, 1.3, 'jaipur'); +insert into t1 values (97, 1.4, 'delhi'); +insert into t1 values (96, 1.5, 'ahmedabad'); +select * from t1; +select * from t1 where i = 98; +select * from t1 where i < 100; + +explain select * from t1 where f > 1.29999; +alter table t1 add index sec_index(f); +explain select * from t1 where f > 1.29999; +select * from t1 where f > 1.29999; + +explain select * from t1 where i = 100; +alter table t1 add unique index pri_index(i); +explain select * from t1 where i = 100; +select * from t1 where i = 100; + +delete from t1 where i < 97; +select * from t1; +insert into t1 values (96, 1.5, 'kolkata'); +select * from t1; + +update t1 set f = 1.44 where c = 'delhi'; +select * from t1; + +truncate table t1; +insert into t1 values (100, 1.1, 'pune'); +insert into t1 values (99, 1.2, 'mumbai'); +insert into t1 values (98, 1.3, 'jaipur'); +insert into t1 values (97, 1.4, 'delhi'); +insert into t1 values (96, 1.5, 'ahmedabad'); +select * from t1; + +--error ER_CANNOT_DISCARD_TEMPORARY_TABLE +alter table t1 discard tablespace; +--error ER_CANNOT_DISCARD_TEMPORARY_TABLE +alter table t1 import tablespace; +drop temporary table t1; + +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 * from t1; +# + +--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; +begin; +--error ER_RECORD_FILE_FULL +call populate_t1(); + +drop procedure populate_t1; + +--echo # test read-only mode +--let $restart_parameters = --innodb-read-only +--source include/restart_mysqld.inc + +--echo # files in MYSQL_DATA_DIR +--list_files $MYSQL_DATA_DIR/ ibtmp* + +--error ER_NO_SUCH_TABLE +select * from t1; +show tables; +--error ER_CANT_CREATE_TABLE +create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb; + +--echo # test various bad start-up parameters + +let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_RANGE = -50000; +let SEARCH_ABORT = NOT FOUND; +let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' +AND support IN ('YES', 'DEFAULT', 'ENABLED'); + +--let $restart_parameters= --innodb_data_file_path=ibdata1:12M:autoextend --innodb_temp_data_file_path=ibdata1:12M:autoextend +--source include/restart_mysqld.inc +--let SEARCH_PATTERN = innodb_temporary and innodb_system file names seem to be the same +--source include/search_pattern_in_file.inc +eval $check_no_innodb; + +--let $restart_parameters= --innodb_temp_data_file_path=foobar:3Gnewraw +--source include/restart_mysqld.inc +--let SEARCH_PATTERN = support raw device +--source include/search_pattern_in_file.inc +eval $check_no_innodb; + +--let $restart_parameters= --innodb_temp_data_file_path=barbar:3Graw +--source include/restart_mysqld.inc +--source include/search_pattern_in_file.inc +eval $check_no_innodb; + +--let $restart_parameters= --innodb_temp_data_file_path=ibtmp1:2M:autoextend +--source include/restart_mysqld.inc +--let SEARCH_PATTERN = The innodb_temporary data file 'ibtmp1' must be at least +--source include/search_pattern_in_file.inc +eval $check_no_innodb; + +--let $restart_parameters= --innodb_temp_data_file_path= +--source include/restart_mysqld.inc +--let SEARCH_PATTERN = InnoDB: syntax error in file path +--source include/search_pattern_in_file.inc +eval $check_no_innodb; + +--let $restart_parameters= +--source include/restart_mysqld.inc + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +create temporary table t ( + i int) + engine = innodb row_format = compressed; +# +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +create temporary table t ( + i int) + engine = innodb row_format = compressed key_block_size = 8; +# +create temporary table t ( + i int) + engine = innodb row_format = dynamic; +show warnings; +drop table t; +# +create temporary table t ( + i int) + engine = innodb row_format = dynamic; +show warnings; +drop table t; +set innodb_strict_mode = off; +# +create temporary table t ( + i int) + engine = innodb row_format = compressed key_block_size = 8; +show warnings; +set innodb_strict_mode = default; +# +drop table t; +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +create temporary table t ( + i int) + engine = innodb row_format = compressed; +--echo #files in MYSQL_TMP_DIR, expecting only default temporary tablespace file +--list_files $MYSQL_TMP_DIR/ *.ibd +--list_files $MYSQL_DATA_DIR/ ibtmp* +# +create temporary table t ( + i int) + engine = innodb row_format = dynamic; +show warnings; +drop table t; +# +create temporary table t ( + i int) + engine = innodb row_format = dynamic; +show warnings; +drop table t; +set innodb_strict_mode = off; +# +create temporary table t ( + i int) + engine = innodb row_format = dynamic key_block_size = 4; +show warnings; +drop table t; +# +create temporary table t ( + i int) + engine = innodb row_format = compact; +show warnings; +drop table t; +# +create temporary table t ( + i int) + engine = innodb key_block_size = 4; +show warnings; +drop table t; +# + +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPACT; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# + +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 8; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# + +# Test alter table for temporary tables with row format = compressed or +# key_block_size +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; + +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +ALTER TABLE t1 KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +ALTER TABLE t1 KEY_BLOCK_SIZE = 4 ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# Set innodb_strict_mode=ON and test compressed temporary tables again. +set innodb_strict_mode = ON; + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; +# + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT; +SHOW WARNINGS; +# + +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; +# + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; +# + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; +SHOW WARNINGS; +# + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7; +SHOW WARNINGS; +# + +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY, + c CHAR(10) NOT NULL +) ENGINE = InnoDB ROW_FORMAT = DYNAMIC; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; +# + +CREATE TEMPORARY TABLE t1 ( + i INT NOT NULL PRIMARY KEY +) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +ALTER TABLE t1 KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; +SHOW WARNINGS; + +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; + +# +# Some checking for turning innodb_strict_mode ON and OFF. +set innodb_strict_mode = OFF; + +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; + +set innodb_strict_mode = ON; + +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; +SHOW CREATE TABLE t1; + +set innodb_strict_mode = OFF; + +ALTER TABLE t1 ROW_FORMAT = COMPRESSED; +SHOW WARNINGS; + +ALTER TABLE t1 KEY_BLOCK_SIZE = 8; +SHOW WARNINGS; + +set innodb_strict_mode = ON; + +--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE +ALTER TABLE t1 ADD COLUMN j INT; +SHOW WARNINGS; +SHOW CREATE TABLE t1; + +set innodb_strict_mode = OFF; + +ALTER TABLE t1 KEY_BLOCK_SIZE = 0; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 ROW_FORMAT = DYNAMIC; + +set innodb_strict_mode = ON; +ALTER TABLE t1 ADD COLUMN j INT; +SHOW CREATE TABLE t1; diff --git a/mysql-test/suite/innodb/t/temporary_table_optimization.opt b/mysql-test/suite/innodb/t/temporary_table_optimization.opt new file mode 100644 index 00000000000..2f73da1ead6 --- /dev/null +++ b/mysql-test/suite/innodb/t/temporary_table_optimization.opt @@ -0,0 +1 @@ +--loose-innodb-sys-datafiles --loose-innodb-sys-tables diff --git a/mysql-test/suite/innodb/t/temporary_table_optimization.test b/mysql-test/suite/innodb/t/temporary_table_optimization.test new file mode 100644 index 00000000000..ae41c87839b --- /dev/null +++ b/mysql-test/suite/innodb/t/temporary_table_optimization.test @@ -0,0 +1,243 @@ +# +# WL#6469: Optimizing CREATE/DROP performance for temporary tables +# +--source include/no_valgrind_without_big.inc +--source include/have_innodb.inc + +######################################################################### +# # +# Will test following scenarios: # +# 1. Create/Drop of temp-table. (with and w/o explicit pk) # +# 2. Truncate temp-table (result in table drop and recreate). # +# 3. Alter of temp-table. # +# 4. Import/Discard of temp-table (to check blocked action) # +# 5. Renaming of temp-table # +# 6. Creating temp-table with large prefix. # +# 7. Check Temp table info not stored in I_S datafile and tables # +######################################################################### + + +#------------------------------------------------------------- +# +# 1. Create/Drop of temp-table. (with and w/o explicit pk) # +# +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +select * from t1 where i = 4; +drop table t1; +# +# recreate table wih same name to ensure entries are removed. +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +select * from t1 where i = 4; +drop table t1; +# +create temporary table t2 (i int) engine = innodb; +insert into t2 values (1), (2), (3), (4); +select * from t2; +select * from t2 where i = 4; +drop table t2; + +#------------------------------------------------------------- +# +# 2. Truncate temp-table (result in table drop and recreate). # +# +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 <= 200) 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 table t1; +# +# recreate table wih same name to ensure entries are removed. +create temporary table t1 (i int) engine = innodb; +insert into t1 values (1), (2), (3), (4); +select * from t1; +select * from t1 where i = 4; +drop table t1; +# +create temporary table t1 + (keyc int, c1 char(100), c2 char(100), + primary key(keyc)) + engine = innodb; +begin; +select count(*) from t1; +call populate_t1(); +select count(*) from t1; +rollback; +select count(*) from t1; +begin; +call populate_t1(); +commit; +select count(*) from t1; +truncate table t1; +select count(*) from t1; +drop table t1; +# +drop procedure populate_t1; + + +#------------------------------------------------------------- +# +# 3. Alter of temp-table. +# +create temporary table t1 (t1_i int, t1_f float) engine = innodb; +insert into t1 values (1, 1.1), (2, 2.2), (3, 2.2), (4, 4.4); +# +explain select * from t1 where t1_i = 1; +alter table t1 add unique index pri_index(t1_i); +explain select * from t1 where t1_i = 1; +select * from t1 where t1_i = 1; +# +--error ER_DUP_ENTRY +alter table t1 add unique index sec_index(t1_f); +alter table t1 add index sec_index(t1_f); +explain select * from t1 where t1_f > 2.2; +select * from t1 where t1_f > 2.2; +# +alter table t1 add column (t1_c char(10)); +select * from t1; +insert into t1 values (5, 5.5, 'krunal'); +# +alter table t1 drop column t1_f; +show create table t1; +--error ER_BAD_FIELD_ERROR +select * from t1 where t1_f > 2.2; +# +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 add index sec_index2(t1_c), algorithm=inplace; +# +drop table t1; + +#------------------------------------------------------------- +# +# 4. Import/Discard of temp-table (to check blocked action) +# +create temporary table t1 (i int, f float) engine = innodb; +insert into t1 values (10, 1.1), (20, 2.2); +select * from t1; +# +--error ER_CANNOT_DISCARD_TEMPORARY_TABLE +alter table t1 discard tablespace; +--error ER_CANNOT_DISCARD_TEMPORARY_TABLE +alter table t1 import tablespace; +drop table t1; + +#------------------------------------------------------------- +# +# 5. Renaming of temp-table # +# +create temporary table t1 (i int) engine=innodb; +insert into t1 values (1), (2), (3); +select * from t1; +# +alter table t1 rename t2; +--error ER_NO_SUCH_TABLE +select * from t1; +select * from t2; +insert into t2 values (1), (2), (6), (7); +select * from t2; +drop table t2; + + +#------------------------------------------------------------- +# +# 6. Creating temp-table with large prefix. # +# +SET sql_mode = 'NO_ENGINE_SUBSTITUTION'; +# This will lead to warnings on innodb_page_size=8k or 4k: +# 8k: Specified key was too long; max key length is 1536 bytes +# 4k: Specified key was too long; max key length is 768 bytes +--disable_warnings +# +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = dynamic engine=innodb; +drop table t; +# +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = dynamic engine=innodb; +drop table t; +# +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = dynamic engine=innodb; +drop table t; +# +SET innodb_strict_mode=OFF; +--error ER_INDEX_COLUMN_TOO_LONG +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = compact engine=innodb; +# +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = dynamic engine=innodb; +drop table t; +# +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = compressed engine=innodb; +drop table t; +# +--error ER_INDEX_COLUMN_TOO_LONG +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = compact engine=innodb; +# +create temporary table t ( + a int not null, + b blob not null, + index sk (b(3021)) + ) row_format = dynamic engine=innodb; +drop table t; +--enable_warnings +# + +#------------------------------------------------------------- +# +# 7. Temp table info not stored in I_S +# +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +CREATE TEMPORARY TABLE t2 ( i INT ) ENGINE = Innodb; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_'; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +CREATE TEMPORARY table t3 ( i INT ) ENGINE = Innodb; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_'; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; +DROP TABLE t1,t2,t3; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_DATAFILES WHERE PATH LIKE '%test%t_'; +SELECT COUNT(*) FROM information_schema.INNODB_SYS_TABLES WHERE NAME LIKE '%test%t_'; diff --git a/mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc b/mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc deleted file mode 100644 index 42e0908f810..00000000000 --- a/mysql-test/suite/innodb_zip/include/innodb_temp_table_dml.inc +++ /dev/null @@ -1,40 +0,0 @@ -# insert test -insert into t1 values (100, 1.1, 'pune'); -insert into t1 values (99, 1.2, 'mumbai'); -insert into t1 values (98, 1.3, 'jaipur'); -insert into t1 values (97, 1.4, 'delhi'); -insert into t1 values (96, 1.5, 'ahmedabad'); -select * from t1; -select * from t1 where i = 98; -select * from t1 where i < 100; -# -# add index using alter table table -explain select * from t1 where f > 1.29999; -alter table t1 add index sec_index(f); -explain select * from t1 where f > 1.29999; -select * from t1 where f > 1.29999; -# -explain select * from t1 where i = 100; -alter table t1 add unique index pri_index(i); -explain select * from t1 where i = 100; -select * from t1 where i = 100; -# -# delete test -delete from t1 where i < 97; -select * from t1; -insert into t1 values (96, 1.5, 'kolkata'); -select * from t1; -# -# update test -update t1 set f = 1.44 where c = 'delhi'; -select * from t1; -# -# truncate table -truncate table t1; -insert into t1 values (100, 1.1, 'pune'); -insert into t1 values (99, 1.2, 'mumbai'); -insert into t1 values (98, 1.3, 'jaipur'); -insert into t1 values (97, 1.4, 'delhi'); -insert into t1 values (96, 1.5, 'ahmedabad'); -select * from t1; - diff --git a/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result b/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result index 9c197737137..72fdceab7e4 100644 --- a/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result +++ b/mysql-test/suite/innodb_zip/r/wl6501_scale_1.result @@ -20,33 +20,143 @@ set i = i + 1; end while; end| set global innodb_file_per_table = 1; -set global innodb_file_format = 'Antelope'; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create table tNUMBER (i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER), index cNUMBER_idx(cNUMBER)) engine=innodb row_format=compact key_block_size=NUMBER; Warnings: -Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER. +Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER unless ROW_FORMAT=COMPRESSED. create table t2 (i int, c1 char(100), c2 char(100), index c1_idx(c1)) engine=innodb row_format=compact key_block_size=16; Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. create temporary table t3 (i int, c1 char(100), c2 char(100), index c1_idx(c1)) engine=innodb row_format=compact key_block_size=16; Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +select count(*) from t1; +count(*) +0 +select count(*) from t2; +count(*) +0 +select count(*) from t3; +count(*) +0 +begin; +call populate(); +commit; +select count(*) from t1; +count(*) +5000 +select count(*) from t2; +count(*) +5000 +select count(*) from t3; +count(*) +5000 +truncate table t1; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +select count(*) from t1; +count(*) +0 +select count(*) from t2; +count(*) +5000 +select count(*) from t3; +count(*) +5000 +call populate_small(); +select count(*) from t1; +count(*) +2000 +select count(*) from t2; +count(*) +7000 +select count(*) from t3; +count(*) +7000 +truncate table t2; +Warnings: +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16 unless ROW_FORMAT=COMPRESSED. +# WL#7811/WL#7743/WL#7141 TODO: Remove the warnings! +truncate table t3; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +select count(*) from t1; +count(*) +2000 +select count(*) from t2; +count(*) +0 +select count(*) from t3; +count(*) +0 +call populate_small(); +select count(*) from t1; +count(*) +4000 +select count(*) from t2; +count(*) +2000 +select count(*) from t3; +count(*) +2000 +drop table t1; +drop table t2; +drop table t3; +drop procedure populate; +drop procedure populate_small; +set global innodb_file_per_table = 1; +set innodb_strict_mode=OFF; +create procedure populate() +begin +declare i int default 1; +while (i <= 5000) do +insert into t1 values (i, 'a', 'b'); +insert into t2 values (i, 'a', 'b'); +insert into t3 values (i, 'a', 'b'); +set i = i + 1; +end while; +end| +create procedure populate_small() +begin +declare i int default 10001; +while (i <= 12000) do +insert into t1 values (i, 'c', 'd'); +insert into t2 values (i, 'a', 'b'); +insert into t3 values (i, 'a', 'b'); +set i = i + 1; +end while; +end| +set global innodb_file_per_table = 1; +create table tNUMBER +(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER), +index cNUMBER_idx(cNUMBER)) +engine=innodb row_format=compressed +key_block_size=NUMBER; +create table t2 +(i int, c1 char(100), c2 char(100), +index c1_idx(c1)) +engine=innodb row_format=compressed +key_block_size=16; +create temporary table t3 +(i int, c1 char(100), c2 char(100), +index c1_idx(c1)) +engine=innodb row_format=compressed +key_block_size=16; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. select count(*) from t1; count(*) 0 @@ -89,7 +199,12 @@ select count(*) from t3; count(*) 7000 truncate table t2; +# WL#7811/WL#7743/WL#7141 TODO: Remove the warnings! truncate table t3; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE. +Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. select count(*) from t1; count(*) 2000 @@ -114,120 +229,6 @@ drop table t2; drop table t3; drop procedure populate; drop procedure populate_small; -set global innodb_file_format = Barracuda; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -set global innodb_file_per_table = 1; -set innodb_strict_mode=OFF; -create procedure populate() -begin -declare i int default 1; -while (i <= 5000) do -insert into t1 values (i, 'a', 'b'); -insert into t2 values (i, 'a', 'b'); -insert into t3 values (i, 'a', 'b'); -set i = i + 1; -end while; -end| -create procedure populate_small() -begin -declare i int default 10001; -while (i <= 12000) do -insert into t1 values (i, 'c', 'd'); -insert into t2 values (i, 'a', 'b'); -insert into t3 values (i, 'a', 'b'); -set i = i + 1; -end while; -end| -set global innodb_file_per_table = 1; -set global innodb_file_format = 'Barracuda'; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html -create table tNUMBER -(i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER), -index cNUMBER_idx(cNUMBER)) -engine=innodb row_format=compressed -key_block_size=NUMBER; -create table t2 -(i int, c1 char(100), c2 char(100), -index c1_idx(c1)) -engine=innodb row_format=compressed -key_block_size=16; -create temporary table t3 -(i int, c1 char(100), c2 char(100), -index c1_idx(c1)) -engine=innodb row_format=compressed -key_block_size=16; -select count(*) from t1; -count(*) -0 -select count(*) from t2; -count(*) -0 -select count(*) from t3; -count(*) -0 -begin; -call populate(); -commit; -select count(*) from t1; -count(*) -5000 -select count(*) from t2; -count(*) -5000 -select count(*) from t3; -count(*) -5000 -truncate table t1; -select count(*) from t1; -count(*) -0 -select count(*) from t2; -count(*) -5000 -select count(*) from t3; -count(*) -5000 -call populate_small(); -select count(*) from t1; -count(*) -2000 -select count(*) from t2; -count(*) -7000 -select count(*) from t3; -count(*) -7000 -truncate table t2; -truncate table t3; -select count(*) from t1; -count(*) -2000 -select count(*) from t2; -count(*) -0 -select count(*) from t3; -count(*) -0 -call populate_small(); -select count(*) from t1; -count(*) -4000 -select count(*) from t2; -count(*) -2000 -select count(*) from t3; -count(*) -2000 -drop table t1; -drop table t2; -drop table t3; -drop procedure populate; -drop procedure populate_small; -set global innodb_file_format = Barracuda; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html set global innodb_file_per_table = 1; set innodb_strict_mode=OFF; create procedure populate() @@ -251,9 +252,6 @@ set i = i + 1; end while; end| set global innodb_file_per_table = 0; -set global innodb_file_format = 'Antelope'; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html create table tNUMBER (i int, cNUMBER char(NUMBER), cNUMBER char(NUMBER), index cNUMBER_idx(cNUMBER)) @@ -261,7 +259,6 @@ engine=innodb row_format=compact key_block_size=NUMBER; Warnings: Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning NUMBER InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Warning NUMBER InnoDB: ignoring KEY_BLOCK_SIZE=NUMBER. create table t2 (i int, c1 char(100), c2 char(100), @@ -270,7 +267,6 @@ engine=innodb row_format=compact key_block_size=16; Warnings: Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. create temporary table t3 (i int, c1 char(100), c2 char(100), @@ -278,9 +274,7 @@ index c1_idx(c1)) engine=innodb row_format=compact key_block_size=16; Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. select count(*) from t1; count(*) 0 @@ -303,6 +297,9 @@ select count(*) from t3; count(*) 5000 truncate table t1; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. select count(*) from t1; count(*) 0 @@ -323,7 +320,13 @@ select count(*) from t3; count(*) 7000 truncate table t2; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. +Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=16. +# WL#7811/WL#7743/WL#7141 TODO: Remove the warnings! truncate table t3; +Warnings: +Warning 1478 InnoDB: KEY_BLOCK_SIZE is ignored for TEMPORARY TABLE. select count(*) from t1; count(*) 2000 @@ -348,7 +351,4 @@ drop table t2; drop table t3; drop procedure populate; drop procedure populate_small; -set global innodb_file_format = Barracuda; -Warnings: -Warning 131 Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html set global innodb_file_per_table = 1; diff --git a/mysql-test/suite/innodb_zip/r/wl6915_1.result b/mysql-test/suite/innodb_zip/r/wl6915_1.result deleted file mode 100644 index bba81098e9d..00000000000 --- a/mysql-test/suite/innodb_zip/r/wl6915_1.result +++ /dev/null @@ -1,2079 +0,0 @@ -call mtr.ADD_suppression(".*Resizing redo log.*"); -call mtr.ADD_suppression(".*Starting to delete and rewrite log files.*"); -call mtr.ADD_suppression(".*New log files created.*"); -SELECT @@global.innodb_undo_tablespaces; -@@global.innodb_undo_tablespaces -0 -CREATE PROCEDURE populate_tables(IN id VARCHAR(10)) -begin -declare n int default 20; -set global innodb_file_per_table=on; -DROP TABLE IF EXISTS t1,t2,t3,t4; -CREATE TEMPORARY TABLE t1_temp(c1 int NOT NULL, -c2 int NOT NULL, -c3 char(255) NOT NULL, -c4 text(600) NOT NULL, -c5 blob(600) NOT NULL, -c6 varchar(600) NOT NULL, -c7 varchar(600) NOT NULL, -c8 datetime, -c9 decimal(6,3), -PRIMARY KEY (c1), -INDEX (c3,c4(50),c5(50)), -INDEX (c2)) -ENGINE=InnoDB ROW_FORMAT=redundant; -set @s = concat("CREATE TABLE t1",id," ( c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=redundant;"); -PREPARE createTable FROM @s; -EXECUTE createTable; -DEALLOCATE PREPARE createTable; -CREATE TEMPORARY TABLE t2_temp(c1 int NOT NULL, -c2 int NOT NULL, -c3 char(255) NOT NULL, -c4 text(600) NOT NULL, -c5 blob(600) NOT NULL, -c6 varchar(600) NOT NULL, -c7 varchar(600) NOT NULL, -c8 datetime, -c9 decimal(6,3), -PRIMARY KEY (c1), -INDEX (c3,c4(50),c5(50)), -INDEX (c2)) -ENGINE=InnoDB ROW_FORMAT=compact; -set @s = concat("CREATE TABLE t2",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compact;"); -PREPARE createTable FROM @s; -EXECUTE createTable; -DEALLOCATE PREPARE createTable; -CREATE TEMPORARY TABLE t3_temp(c1 int NOT NULL, -c2 int NOT NULL, -c3 char(255) NOT NULL, -c4 text(600) NOT NULL, -c5 blob(600) NOT NULL, -c6 varchar(600) NOT NULL, -c7 varchar(600) NOT NULL, -c8 datetime, -c9 decimal(6,3), -PRIMARY KEY (c1), -INDEX (c3,c4(50),c5(50)), -INDEX (c2)) -ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4; -set @s = concat("CREATE TABLE t3",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4;"); -PREPARE createTable FROM @s; -EXECUTE createTable; -DEALLOCATE PREPARE createTable; -CREATE TEMPORARY TABLE t4_temp(c1 int NOT NULL, -c2 int NOT NULL, -c3 char(255) NOT NULL, -c4 text(600) NOT NULL, -c5 blob(600) NOT NULL, -c6 varchar(600) NOT NULL, -c7 varchar(600) NOT NULL, -c8 datetime, -c9 decimal(6,3), -PRIMARY KEY (c1), -INDEX (c3,c4(50),c5(50)), -INDEX (c2)) -ENGINE=InnoDB ROW_FORMAT=dynamic; -set @s = concat("CREATE TABLE t4",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=dynamic;"); -PREPARE createTable FROM @s; -EXECUTE createTable; -DEALLOCATE PREPARE createTable; -while (n > 0) do -START TRANSACTION; -set @s = concat("INSERT INTO t1",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t1_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), -REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), -REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), -NOW(),(100.55+n)); -set @s = concat("INSERT INTO t2",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t2_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), -REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), -REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), -NOW(),(100.55+n)); -savepoint a; -set @s = concat("INSERT INTO t3",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t3_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), -REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), -REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), -NOW(),(100.55+n)); -savepoint b; -set @s = concat("INSERT INTO t4",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t4_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), -REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), -REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), -NOW(),(100.55+n)); -if (n > 10) then -if (n > 10 and n <=12) then -ROLLBACK TO SAVEPOINT a; -COMMIT; -end if; -if (n > 12 and n < 15) then -ROLLBACK TO SAVEPOINT b; -COMMIT; -end if; -if (n > 15) then -COMMIT; -end if; -else -if (n > 5) then -START TRANSACTION; -DELETE FROM t1_temp WHERE c1 > 10 ; -DELETE FROM t2_temp WHERE c1 > 10 ; -DELETE FROM t3_temp WHERE c1 > 10 ; -DELETE FROM t4_temp WHERE c1 > 10 ; -rollback; -START TRANSACTION; -update t1_temp set c1 = c1 + 1000 WHERE c1 > 10; -update t2_temp set c1 = c1 + 1000 WHERE c1 > 10; -update t3_temp set c1 = c1 + 1000 WHERE c1 > 10; -update t4_temp set c1 = c1 + 1000 WHERE c1 > 10; -rollback; -end if; -end if; -if (n < 5) then -rollback; -end if; -FLUSH logs; -ALTER TABLE t1_temp DROP PRIMARY KEY; -ALTER TABLE t1_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); -ALTER TABLE t2_temp DROP PRIMARY KEY; -ALTER TABLE t2_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); -ALTER TABLE t3_temp DROP PRIMARY KEY; -ALTER TABLE t3_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); -ALTER TABLE t4_temp DROP PRIMARY KEY; -ALTER TABLE t4_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); -FLUSH tables; -START TRANSACTION; -set @s = concat("INSERT INTO t1",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t1_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t2",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t2_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t3",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t3_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t4",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t4_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -DELETE FROM t1_temp WHERE c1 between 100 and 110; -DELETE FROM t2_temp WHERE c1 between 100 and 110; -DELETE FROM t3_temp WHERE c1 between 100 and 110; -DELETE FROM t4_temp WHERE c1 between 100 and 110; -update t1_temp set c1 = c1+1 WHERE c1>110; -update t2_temp set c1 = c1+1 WHERE c1>110; -update t3_temp set c1 = c1+1 WHERE c1>110; -update t4_temp set c1 = c1+1 WHERE c1>110; -savepoint a; -set @s = concat("INSERT INTO t1",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t1_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t2",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t2_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t3",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t3_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t4",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t4_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -savepoint b; -set @s = concat("INSERT INTO t1",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t1_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t2",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t2_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t3",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t3_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -set @s = concat("INSERT INTO t4",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); -PREPARE insertIntoTable FROM @s; -EXECUTE insertIntoTable; -DEALLOCATE PREPARE insertIntoTable; -INSERT INTO t4_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), -REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), -REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), -NOW(),(100.55+n+100)); -savepoint c; -rollback to b; -rollback to a; -COMMIT; -COMMIT; -rollback; -set n = n - 1; -end while; -end| -connect con1,localhost,root,,; -connect con2,localhost,root,,; -#---client 1 : dml operation ---" -connection con1; -#---client 2 : dml operation ---" -connection con2; -# In connection 1 -connection con1; -SELECT count(*) FROM t1_1; -count(*) -36 -SELECT count(*) FROM t2_1; -count(*) -36 -SELECT count(*) FROM t3_1; -count(*) -34 -SELECT count(*) FROM t4_1; -count(*) -32 -SELECT c1 FROM t1_1; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t2_1; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t3_1; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t4_1; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT count(*) FROM t1_temp; -count(*) -26 -SELECT count(*) FROM t2_temp; -count(*) -26 -SELECT count(*) FROM t3_temp; -count(*) -24 -SELECT count(*) FROM t4_temp; -count(*) -22 -SELECT c1 FROM t1_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t2_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t3_temp; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t4_temp; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -# In connection 2 -connection con2; -SELECT count(*) FROM t1_2; -count(*) -36 -SELECT count(*) FROM t2_2; -count(*) -36 -SELECT count(*) FROM t3_2; -count(*) -34 -SELECT count(*) FROM t4_2; -count(*) -32 -SELECT c1 FROM t1_2; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t2_2; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t3_2; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t4_2; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT count(*) FROM t1_temp; -count(*) -26 -SELECT count(*) FROM t2_temp; -count(*) -26 -SELECT count(*) FROM t3_temp; -count(*) -24 -SELECT count(*) FROM t4_temp; -count(*) -22 -SELECT c1 FROM t1_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t2_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t3_temp; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t4_temp; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -# In connection 1 -connection con1; -set AUTOCOMMIT = 0; -ALTER TABLE t1_temp DROP PRIMARY KEY; -ALTER TABLE t1_temp ADD PRIMARY KEY (c1); -ALTER TABLE t2_temp DROP PRIMARY KEY; -ALTER TABLE t2_temp ADD PRIMARY KEY (c1); -ALTER TABLE t3_temp DROP PRIMARY KEY; -ALTER TABLE t3_temp ADD PRIMARY KEY (c1); -ALTER TABLE t4_temp DROP PRIMARY KEY; -ALTER TABLE t4_temp ADD PRIMARY KEY (c1); -INSERT INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -insert ignore into t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -Warnings: -Warning 1062 Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -insert ignore into t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -Warnings: -Warning 1062 Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -insert ignore into t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -Warnings: -Warning 1062 Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -insert ignore into t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -Warnings: -Warning 1062 Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t1_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t2_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t3_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -INSERT INTO t4_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); -ERROR 23000: Duplicate entry '20' for key 'PRIMARY' -set AUTOCOMMIT = 1; -SELECT c1,c2 FROM t1_temp WHERE c1 in (20,1); -c1 c2 -20 20 -SELECT c1,c2 FROM t2_temp WHERE c1 in (20,1); -c1 c2 -20 20 -SELECT c1,c2 FROM t3_temp WHERE c1 in (20,1); -c1 c2 -20 20 -SELECT c1,c2 FROM t4_temp WHERE c1 in (20,1); -c1 c2 -20 20 -REPLACE INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -REPLACE INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -REPLACE INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -REPLACE INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t1_temp WHERE c1 = 20; -c1 c2 c3 c4 c5 c6 c7 c9 -20 1 a a a a a 100.550 -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t2_temp WHERE c1 = 20; -c1 c2 c3 c4 c5 c6 c7 c9 -20 1 a a a a a 100.550 -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t3_temp WHERE c1 = 20; -c1 c2 c3 c4 c5 c6 c7 c9 -20 1 a a a a a 100.550 -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t4_temp WHERE c1 = 20; -c1 c2 c3 c4 c5 c6 c7 c9 -20 1 a a a a a 100.550 -update ignore t1_temp set c1 = 20 WHERE c1 = 140 ; -update ignore t2_temp set c1 = 20 WHERE c1 = 140 ; -update ignore t3_temp set c1 = 20 WHERE c1 = 140 ; -update ignore t4_temp set c1 = 20 WHERE c1 = 140 ; -SELECT count(*) FROM t1_temp WHERE c1 = 140; -count(*) -1 -SELECT count(*) FROM t2_temp WHERE c1 = 140; -count(*) -1 -SELECT count(*) FROM t3_temp WHERE c1 = 140; -count(*) -1 -SELECT count(*) FROM t4_temp WHERE c1 = 140; -count(*) -1 -ALTER TABLE t1_temp ADD COLUMN c10 int default 99 , -ADD COLUMN c11 varchar(100) default 'test'; -ALTER TABLE t1_temp DROP PRIMARY KEY; -ALTER TABLE t1_temp ADD PRIMARY KEY (c1); -INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55); -SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0; -c1 c2 c3 c4 c5 c6 c7 c9 c10 c11 --1 -1 a a a a a 100.550 99 test -SELECT count(*) FROM t1_temp WHERE c10 = 99 and c11 like 'test'; -count(*) -27 -INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55) -ON DUPLICATE KEY UPDATE c1=-2,c2=-2; -SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0; -c1 c2 c3 c4 c5 c6 c7 c9 c10 c11 --2 -2 a a a a a 100.550 99 test -DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1; -disconnect con1; -connection con2; -DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2; -disconnect con2; -connection default; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -call populate_tables('_1');; -connection con2; -call populate_tables('_2');; -"#connection 1 - verify tables" -connection con1; -SELECT count(*) FROM t1_1; -count(*) -36 -SELECT count(*) FROM t2_1; -count(*) -36 -SELECT count(*) FROM t3_1; -count(*) -34 -SELECT count(*) FROM t4_1; -count(*) -32 -SELECT c1 FROM t1_1; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t2_1; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t3_1; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t4_1; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT count(*) FROM t1_temp; -count(*) -26 -SELECT count(*) FROM t2_temp; -count(*) -26 -SELECT count(*) FROM t3_temp; -count(*) -24 -SELECT count(*) FROM t4_temp; -count(*) -22 -SELECT c1 FROM t1_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t2_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t3_temp; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t4_temp; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1; -disconnect con1; -"#connection 2 - verify tables" -connection con2; -SELECT count(*) FROM t1_2; -count(*) -36 -SELECT count(*) FROM t2_2; -count(*) -36 -SELECT count(*) FROM t3_2; -count(*) -34 -SELECT count(*) FROM t4_2; -count(*) -32 -SELECT c1 FROM t1_2; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t2_2; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t3_2; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t4_2; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT count(*) FROM t1_temp; -count(*) -26 -SELECT count(*) FROM t2_temp; -count(*) -26 -SELECT count(*) FROM t3_temp; -count(*) -24 -SELECT count(*) FROM t4_temp; -count(*) -22 -SELECT c1 FROM t1_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t2_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t3_temp; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t4_temp; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2; -disconnect con2; -connection default; -connect con1,localhost,root,,; -connect con2,localhost,root,,; -connection con1; -call populate_tables('_1');; -connection con2; -call populate_tables('_2');; -"#connection 1 - verify tables" -connection con1; -SELECT count(*) FROM t1_1; -count(*) -36 -SELECT count(*) FROM t2_1; -count(*) -36 -SELECT count(*) FROM t3_1; -count(*) -34 -SELECT count(*) FROM t4_1; -count(*) -32 -SELECT c1 FROM t1_1; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t2_1; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t3_1; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t4_1; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT count(*) FROM t1_temp; -count(*) -26 -SELECT count(*) FROM t2_temp; -count(*) -26 -SELECT count(*) FROM t3_temp; -count(*) -24 -SELECT count(*) FROM t4_temp; -count(*) -22 -SELECT c1 FROM t1_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t2_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t3_temp; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t4_temp; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1; -disconnect con1; -"#connection 2 - verify tables" -connection con2; -SELECT count(*) FROM t1_2; -count(*) -36 -SELECT count(*) FROM t2_2; -count(*) -36 -SELECT count(*) FROM t3_2; -count(*) -34 -SELECT count(*) FROM t4_2; -count(*) -32 -SELECT c1 FROM t1_2; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t2_2; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t3_2; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT c1 FROM t4_2; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -SELECT count(*) FROM t1_temp; -count(*) -26 -SELECT count(*) FROM t2_temp; -count(*) -26 -SELECT count(*) FROM t3_temp; -count(*) -24 -SELECT count(*) FROM t4_temp; -count(*) -22 -SELECT c1 FROM t1_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t2_temp; -c1 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t3_temp; -c1 -5 -6 -7 -8 -9 -10 -13 -14 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -SELECT c1 FROM t4_temp; -c1 -5 -6 -7 -8 -9 -10 -15 -16 -17 -18 -19 -20 -122 -124 -126 -128 -130 -132 -134 -136 -138 -140 -DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2; -disconnect con2; -connection default; -DROP PROCEDURE populate_tables; diff --git a/mysql-test/suite/innodb_zip/t/disabled.def b/mysql-test/suite/innodb_zip/t/disabled.def deleted file mode 100644 index 02adb097c9d..00000000000 --- a/mysql-test/suite/innodb_zip/t/disabled.def +++ /dev/null @@ -1,14 +0,0 @@ -############################################################################## -# -# List the test cases that are to be disabled temporarily. -# -# Separate the test case name and the comment with ':'. -# -# : BUG# -# -# Do not use any TAB characters for whitespace. -# -############################################################################## - -wl6560 : Very long, timeout - diff --git a/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test b/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test index 8c746fe8abf..e6392759d5e 100644 --- a/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test +++ b/mysql-test/suite/innodb_zip/t/wl6501_scale_1.test @@ -22,20 +22,16 @@ let $wl6501_file_per_table = 1; let $wl6501_row_fmt = compact; let $wl6501_kbs = 16; -let $wl6501_file_format = 'Antelope'; --source suite/innodb_zip/include/innodb_wl6501_scale.inc # Single-Tablespace/Compressed let $wl6501_file_per_table = 1; let $wl6501_row_fmt = compressed; let $wl6501_kbs = 16; -let $wl6501_file_format = 'Barracuda'; --source suite/innodb_zip/include/innodb_wl6501_scale.inc # System-Tablespace/Non-Compressed let $wl6501_file_per_table = 0; let $wl6501_row_fmt = compact; let $wl6501_kbs = 16; -let $wl6501_file_format = 'Antelope'; --source suite/innodb_zip/include/innodb_wl6501_scale.inc - diff --git a/mysql-test/suite/innodb_zip/t/wl6560.test b/mysql-test/suite/innodb_zip/t/wl6560.test deleted file mode 100644 index 55d36747938..00000000000 --- a/mysql-test/suite/innodb_zip/t/wl6560.test +++ /dev/null @@ -1,422 +0,0 @@ -# -# 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/ ---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/ ---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/ ---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/ ---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/ ---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/ ---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/ ---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/ ---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/ ---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; diff --git a/mysql-test/suite/innodb_zip/t/wl6915_1.test b/mysql-test/suite/innodb_zip/t/wl6915_1.test deleted file mode 100644 index 7f0f734d16a..00000000000 --- a/mysql-test/suite/innodb_zip/t/wl6915_1.test +++ /dev/null @@ -1,650 +0,0 @@ ---source include/have_innodb.inc ---source include/have_innodb_zip.inc ---source include/have_no_undo_tablespaces.inc ---source include/big_test.inc - -# Embedded server does not support restarting ---source include/not_embedded.inc -# Avoid CrashReporter popup on Mac ---source include/not_crashrep.inc - -#################################################################### -# TC to test temp-table undolog changes correctness # -# Sceanrio covered in single testcase : # -# - Tables with row format(redundant,compressed,dynamic,compact # -# - Table with primary,composite,prefix,secondary INDEX # -# - Insert/delete/update with transactioons # -# - Transaction with COMMIT,rollback,savepoint statements # -# - Transaction having temporary table and normal table # -# - Concurrency by execution of two clients creating tables with # -# same names # -# - Inserting data using # -# - Insert into .. , Load data infile..,insert ignore # -# - Insert into .. on duplicate update # -# - Check basic delete and upadte [ignore] # -# - Check constraints like duplicate key,default value # -# - Alter ADD COLUMN , ADD PRIMARY KEY # -# - Flush Tables, logs command # -# - Vary innodb_undo_tablespaces=0,innodb_undo_logs # -# innodb_log_files_in_group # -# - Verify rseg message from server log # -#################################################################### - -# run for page size >= 8k ---disable_warnings -if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value >= 8192`) -{ - --skip Test requires InnoDB with page size >= 8k. -} ---enable_warnings - -call mtr.ADD_suppression(".*Resizing redo log.*"); -call mtr.ADD_suppression(".*Starting to delete and rewrite log files.*"); -call mtr.ADD_suppression(".*New log files created.*"); -# Save initial VALUES of server variable ---disable_query_log -let $innodb_file_per_table_orig=`SELECT @@innodb_file_per_table`; ---enable_query_log - -SELECT @@global.innodb_undo_tablespaces; - -# Create procedure to perform -# 1. Create temp table with row types , INDEX , sufficent data types -# 2. Perform DML with transaction -delimiter |; -CREATE PROCEDURE populate_tables(IN id VARCHAR(10)) - begin - declare n int default 20; - set global innodb_file_per_table=on; - DROP TABLE IF EXISTS t1,t2,t3,t4; - - CREATE TEMPORARY TABLE t1_temp(c1 int NOT NULL, - c2 int NOT NULL, - c3 char(255) NOT NULL, - c4 text(600) NOT NULL, - c5 blob(600) NOT NULL, - c6 varchar(600) NOT NULL, - c7 varchar(600) NOT NULL, - c8 datetime, - c9 decimal(6,3), - PRIMARY KEY (c1), - INDEX (c3,c4(50),c5(50)), - INDEX (c2)) - ENGINE=InnoDB ROW_FORMAT=redundant; - - set @s = concat("CREATE TABLE t1",id," ( c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=redundant;"); - PREPARE createTable FROM @s; - EXECUTE createTable; - DEALLOCATE PREPARE createTable; - - - CREATE TEMPORARY TABLE t2_temp(c1 int NOT NULL, - c2 int NOT NULL, - c3 char(255) NOT NULL, - c4 text(600) NOT NULL, - c5 blob(600) NOT NULL, - c6 varchar(600) NOT NULL, - c7 varchar(600) NOT NULL, - c8 datetime, - c9 decimal(6,3), - PRIMARY KEY (c1), - INDEX (c3,c4(50),c5(50)), - INDEX (c2)) - ENGINE=InnoDB ROW_FORMAT=compact; - - set @s = concat("CREATE TABLE t2",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compact;"); - PREPARE createTable FROM @s; - EXECUTE createTable; - DEALLOCATE PREPARE createTable; - - CREATE TEMPORARY TABLE t3_temp(c1 int NOT NULL, - c2 int NOT NULL, - c3 char(255) NOT NULL, - c4 text(600) NOT NULL, - c5 blob(600) NOT NULL, - c6 varchar(600) NOT NULL, - c7 varchar(600) NOT NULL, - c8 datetime, - c9 decimal(6,3), - PRIMARY KEY (c1), - INDEX (c3,c4(50),c5(50)), - INDEX (c2)) - ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4; - - set @s = concat("CREATE TABLE t3",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=compressed key_block_size=4;"); - PREPARE createTable FROM @s; - EXECUTE createTable; - DEALLOCATE PREPARE createTable; - - CREATE TEMPORARY TABLE t4_temp(c1 int NOT NULL, - c2 int NOT NULL, - c3 char(255) NOT NULL, - c4 text(600) NOT NULL, - c5 blob(600) NOT NULL, - c6 varchar(600) NOT NULL, - c7 varchar(600) NOT NULL, - c8 datetime, - c9 decimal(6,3), - PRIMARY KEY (c1), - INDEX (c3,c4(50),c5(50)), - INDEX (c2)) - ENGINE=InnoDB ROW_FORMAT=dynamic; - - set @s = concat("CREATE TABLE t4",id," (c1 int NOT NULL, c2 int NOT NULL, c3 char(255) NOT NULL, c4 text(600) NOT NULL, c5 blob(600) NOT NULL, c6 varchar(600) NOT NULL, c7 varchar(600) NOT NULL, c8 datetime, c9 decimal(6,3), PRIMARY KEY (c1), INDEX (c3,c4(50),c5(50)), INDEX (c2)) ENGINE=InnoDB ROW_FORMAT=dynamic;"); - PREPARE createTable FROM @s; - EXECUTE createTable; - DEALLOCATE PREPARE createTable; - - while (n > 0) do - START TRANSACTION; - set @s = concat("INSERT INTO t1",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t1_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), - REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), - REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), - NOW(),(100.55+n)); - - set @s = concat("INSERT INTO t2",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - - INSERT INTO t2_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), - REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), - REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), - NOW(),(100.55+n)); - - savepoint a; - - set @s = concat("INSERT INTO t3",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - - INSERT INTO t3_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), - REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), - REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), - NOW(),(100.55+n)); - - savepoint b; - - set @s = concat("INSERT INTO t4",id," VALUES(",n,",",n,",REPEAT(concat(' tc3_',",n,"),30), REPEAT(concat(' tc4_',",n,"),70),REPEAT(concat(' tc_',",n,"),70), REPEAT(concat(' tc6_',",n,"),70),REPEAT(concat(' tc7_',",n,"),70), NOW(),(100.55+",n,"));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - - INSERT INTO t4_temp VALUES(n,n,REPEAT(concat(' tc3_',n),30), - REPEAT(concat(' tc4_',n),70),REPEAT(concat(' tc_',n),70), - REPEAT(concat(' tc6_',n),70),REPEAT(concat(' tc7_',n),70), - NOW(),(100.55+n)); - - - if (n > 10) then - if (n > 10 and n <=12) then - ROLLBACK TO SAVEPOINT a; - COMMIT; - end if; - if (n > 12 and n < 15) then - ROLLBACK TO SAVEPOINT b; - COMMIT; - end if; - if (n > 15) then - COMMIT; - end if; - - else - if (n > 5) then - START TRANSACTION; - DELETE FROM t1_temp WHERE c1 > 10 ; - DELETE FROM t2_temp WHERE c1 > 10 ; - DELETE FROM t3_temp WHERE c1 > 10 ; - DELETE FROM t4_temp WHERE c1 > 10 ; - - rollback; - START TRANSACTION; - update t1_temp set c1 = c1 + 1000 WHERE c1 > 10; - update t2_temp set c1 = c1 + 1000 WHERE c1 > 10; - update t3_temp set c1 = c1 + 1000 WHERE c1 > 10; - update t4_temp set c1 = c1 + 1000 WHERE c1 > 10; - rollback; - end if; - end if; - - if (n < 5) then - rollback; - end if; - - FLUSH logs; - ALTER TABLE t1_temp DROP PRIMARY KEY; - ALTER TABLE t1_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); - ALTER TABLE t2_temp DROP PRIMARY KEY; - ALTER TABLE t2_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); - ALTER TABLE t3_temp DROP PRIMARY KEY; - ALTER TABLE t3_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); - ALTER TABLE t4_temp DROP PRIMARY KEY; - ALTER TABLE t4_temp ADD PRIMARY KEY (c1,c3(10),c4(10)); - FLUSH tables; - - START TRANSACTION; - set @s = concat("INSERT INTO t1",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t1_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t2",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t2_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t3",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t3_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t4",id," VALUES(",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t4_temp VALUES(n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - - - DELETE FROM t1_temp WHERE c1 between 100 and 110; - DELETE FROM t2_temp WHERE c1 between 100 and 110; - DELETE FROM t3_temp WHERE c1 between 100 and 110; - DELETE FROM t4_temp WHERE c1 between 100 and 110; - - update t1_temp set c1 = c1+1 WHERE c1>110; - update t2_temp set c1 = c1+1 WHERE c1>110; - update t3_temp set c1 = c1+1 WHERE c1>110; - update t4_temp set c1 = c1+1 WHERE c1>110; - - savepoint a; - - set @s = concat("INSERT INTO t1",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t1_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t2",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t2_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t3",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t3_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t4",id," VALUES(300+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t4_temp VALUES(300+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - savepoint b; - - set @s = concat("INSERT INTO t1",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t1_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t2",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t2_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t3",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t3_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - set @s = concat("INSERT INTO t4",id," VALUES(400+",n,"+100,",n,"+100,REPEAT(concat(' tc3_',",n,"+100),30), REPEAT(concat(' tc4_',",n,"+100),70),REPEAT(concat(' tc_',",n,"+100),70), REPEAT(concat(' tc6_',",n,"+100),60),REPEAT(concat(' tc7_',",n,"+100),60), NOW(),(100.55+",n,"+100));"); - PREPARE insertIntoTable FROM @s; - EXECUTE insertIntoTable; - DEALLOCATE PREPARE insertIntoTable; - INSERT INTO t4_temp VALUES(400+n+100,n+100,REPEAT(concat(' tc3_',n+100),30), - REPEAT(concat(' tc4_',n+100),70),REPEAT(concat(' tc_',n+100),70), - REPEAT(concat(' tc6_',n+100),60),REPEAT(concat(' tc7_',n+100),60), - NOW(),(100.55+n+100)); - savepoint c; - rollback to b; - rollback to a; - COMMIT; - COMMIT; - rollback; - set n = n - 1; - end while; -end| -delimiter ;| - -# Create two client for concurrent execution -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); - ---echo #---client 1 : dml operation ---" -connection con1; --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; - --- enable_query_log --- disable_query_log -# call procedure ---send call populate_tables('_1'); --- enable_query_log - ---echo #---client 2 : dml operation ---" -connection con2; --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; --- enable_query_log --- disable_query_log -# call procedure ---send call populate_tables('_2'); - --- enable_query_log - -# check data of client connection 1 ---echo # In connection 1 -connection con1; ---reap -# 20 rows exepceted in 5 tables -SELECT count(*) FROM t1_1; -SELECT count(*) FROM t2_1; -SELECT count(*) FROM t3_1; -SELECT count(*) FROM t4_1; -SELECT c1 FROM t1_1; -SELECT c1 FROM t2_1; -SELECT c1 FROM t3_1; -SELECT c1 FROM t4_1; -SELECT count(*) FROM t1_temp; -SELECT count(*) FROM t2_temp; -SELECT count(*) FROM t3_temp; -SELECT count(*) FROM t4_temp; -SELECT c1 FROM t1_temp; -SELECT c1 FROM t2_temp; -SELECT c1 FROM t3_temp; -SELECT c1 FROM t4_temp; -# check data of client connection 2 ---echo # In connection 2 -connection con2; ---reap -# 20 rows exepceted in 5 tables -SELECT count(*) FROM t1_2; -SELECT count(*) FROM t2_2; -SELECT count(*) FROM t3_2; -SELECT count(*) FROM t4_2; -SELECT c1 FROM t1_2; -SELECT c1 FROM t2_2; -SELECT c1 FROM t3_2; -SELECT c1 FROM t4_2; -SELECT count(*) FROM t1_temp; -SELECT count(*) FROM t2_temp; -SELECT count(*) FROM t3_temp; -SELECT count(*) FROM t4_temp; -SELECT c1 FROM t1_temp; -SELECT c1 FROM t2_temp; -SELECT c1 FROM t3_temp; -SELECT c1 FROM t4_temp; - ---echo # In connection 1 -connection con1; - -set AUTOCOMMIT = 0; -ALTER TABLE t1_temp DROP PRIMARY KEY; -ALTER TABLE t1_temp ADD PRIMARY KEY (c1); -ALTER TABLE t2_temp DROP PRIMARY KEY; -ALTER TABLE t2_temp ADD PRIMARY KEY (c1); -ALTER TABLE t3_temp DROP PRIMARY KEY; -ALTER TABLE t3_temp ADD PRIMARY KEY (c1); -ALTER TABLE t4_temp DROP PRIMARY KEY; -ALTER TABLE t4_temp ADD PRIMARY KEY (c1); -# Check duplicate key constraint + insert ignore ---error ER_DUP_ENTRY -INSERT INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -insert ignore into t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); ---error ER_DUP_ENTRY -INSERT INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -insert ignore into t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); ---error ER_DUP_ENTRY -INSERT INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -insert ignore into t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); ---error ER_DUP_ENTRY -INSERT INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -insert ignore into t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); - -# check rollback due to duplicate value in second record of insert ---error ER_DUP_ENTRY -INSERT INTO t1_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); ---error ER_DUP_ENTRY -INSERT INTO t2_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); ---error ER_DUP_ENTRY -INSERT INTO t3_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); ---error ER_DUP_ENTRY -INSERT INTO t4_temp VALUES (1,1,'a','a','a','a','a',NOW(),100.55), -(20,1,'a','a','a','a','a',NOW(),100.55); - -set AUTOCOMMIT = 1; - -SELECT c1,c2 FROM t1_temp WHERE c1 in (20,1); -SELECT c1,c2 FROM t2_temp WHERE c1 in (20,1); -SELECT c1,c2 FROM t3_temp WHERE c1 in (20,1); -SELECT c1,c2 FROM t4_temp WHERE c1 in (20,1); - -#replace statement -REPLACE INTO t1_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -REPLACE INTO t2_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -REPLACE INTO t3_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -REPLACE INTO t4_temp VALUES (20,1,'a','a','a','a','a',NOW(),100.55); -# verify row is replaced FROM (20,20) to (20,1) -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t1_temp WHERE c1 = 20; -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t2_temp WHERE c1 = 20; -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t3_temp WHERE c1 = 20; -SELECT c1,c2,c3,c4,c5,c6,c7,c9 FROM t4_temp WHERE c1 = 20; - -# Update ignore. statement is gonored as 20 value exits -update ignore t1_temp set c1 = 20 WHERE c1 = 140 ; -update ignore t2_temp set c1 = 20 WHERE c1 = 140 ; -update ignore t3_temp set c1 = 20 WHERE c1 = 140 ; -update ignore t4_temp set c1 = 20 WHERE c1 = 140 ; -# see record 140 is present as last update ignored -SELECT count(*) FROM t1_temp WHERE c1 = 140; -SELECT count(*) FROM t2_temp WHERE c1 = 140; -SELECT count(*) FROM t3_temp WHERE c1 = 140; -SELECT count(*) FROM t4_temp WHERE c1 = 140; - -# Alter table to ADD COLUMN and PRIMARY KEY -ALTER TABLE t1_temp ADD COLUMN c10 int default 99 , -ADD COLUMN c11 varchar(100) default 'test'; -ALTER TABLE t1_temp DROP PRIMARY KEY; -ALTER TABLE t1_temp ADD PRIMARY KEY (c1); -INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55); -SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0; -SELECT count(*) FROM t1_temp WHERE c10 = 99 and c11 like 'test'; -# insert on duplicate key update -INSERT INTO t1_temp (c1,c2,c3,c4,c5,c6,c7,c8,c9) VALUES (-1,-1,'a','a','a','a','a',NOW(),100.55) -ON DUPLICATE KEY UPDATE c1=-2,c2=-2; -SELECT c1,c2,c3,c4,c5,c6,c7,c9,c10,c11 FROM t1_temp WHERE c1 < 0; - -# - -#cleanup -DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1; -disconnect con1; - -connection con2; -DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2; -disconnect con2; - - -connection default; -# -## trying with VALUES innodb_undo_tablespaces, innodb_undo_logs ,innodb_log_files_in_group -## -let $restart_parameters=--innodb_undo_tablespaces=0 --innodb_rollback_segments=20 --innodb_undo_logs=20 --innodb_log_files_in_group=4; ---source include/restart_mysqld.inc - -# Create two client for concurrent execution -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); -# -# -connection con1; ---send call populate_tables('_1'); -connection con2; ---send call populate_tables('_2'); ---echo "#connection 1 - verify tables" -connection con1; ---reap -SELECT count(*) FROM t1_1; -SELECT count(*) FROM t2_1; -SELECT count(*) FROM t3_1; -SELECT count(*) FROM t4_1; -SELECT c1 FROM t1_1; -SELECT c1 FROM t2_1; -SELECT c1 FROM t3_1; -SELECT c1 FROM t4_1; -SELECT count(*) FROM t1_temp; -SELECT count(*) FROM t2_temp; -SELECT count(*) FROM t3_temp; -SELECT count(*) FROM t4_temp; -SELECT c1 FROM t1_temp; -SELECT c1 FROM t2_temp; -SELECT c1 FROM t3_temp; -SELECT c1 FROM t4_temp; -DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1; -disconnect con1; ---echo "#connection 2 - verify tables" -connection con2; ---reap -SELECT count(*) FROM t1_2; -SELECT count(*) FROM t2_2; -SELECT count(*) FROM t3_2; -SELECT count(*) FROM t4_2; -SELECT c1 FROM t1_2; -SELECT c1 FROM t2_2; -SELECT c1 FROM t3_2; -SELECT c1 FROM t4_2; -SELECT count(*) FROM t1_temp; -SELECT count(*) FROM t2_temp; -SELECT count(*) FROM t3_temp; -SELECT count(*) FROM t4_temp; -SELECT c1 FROM t1_temp; -SELECT c1 FROM t2_temp; -SELECT c1 FROM t3_temp; -SELECT c1 FROM t4_temp; -DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2; -disconnect con2; - -connection default; -# innodb_undo_logs > non redo rsegment -let $restart_parameters=--innodb_undo_tablespaces=0 --innodb_rollback_segments=30 --innodb_undo_logs=20 --innodb_log_files_in_group=4; ---source include/restart_mysqld.inc - -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); - -connection con1; ---send call populate_tables('_1'); -connection con2; ---send call populate_tables('_2'); ---echo "#connection 1 - verify tables" -connection con1; ---reap -SELECT count(*) FROM t1_1; -SELECT count(*) FROM t2_1; -SELECT count(*) FROM t3_1; -SELECT count(*) FROM t4_1; -SELECT c1 FROM t1_1; -SELECT c1 FROM t2_1; -SELECT c1 FROM t3_1; -SELECT c1 FROM t4_1; -SELECT count(*) FROM t1_temp; -SELECT count(*) FROM t2_temp; -SELECT count(*) FROM t3_temp; -SELECT count(*) FROM t4_temp; -SELECT c1 FROM t1_temp; -SELECT c1 FROM t2_temp; -SELECT c1 FROM t3_temp; -SELECT c1 FROM t4_temp; -DROP TABLE t1_1 ,t2_1 ,t3_1,t4_1; -disconnect con1; ---echo "#connection 2 - verify tables" -connection con2; ---reap -SELECT count(*) FROM t1_2; -SELECT count(*) FROM t2_2; -SELECT count(*) FROM t3_2; -SELECT count(*) FROM t4_2; -SELECT c1 FROM t1_2; -SELECT c1 FROM t2_2; -SELECT c1 FROM t3_2; -SELECT c1 FROM t4_2; -SELECT count(*) FROM t1_temp; -SELECT count(*) FROM t2_temp; -SELECT count(*) FROM t3_temp; -SELECT count(*) FROM t4_temp; -SELECT c1 FROM t1_temp; -SELECT c1 FROM t2_temp; -SELECT c1 FROM t3_temp; -SELECT c1 FROM t4_temp; -DROP TABLE t1_2 ,t2_2 ,t3_2,t4_2; -disconnect con2; - -# - -connection default; -DROP PROCEDURE populate_tables; - -# check message in log -let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err; -let SEARCH_FILE= $error_log; -# We get depending on the platform either "./ibdata1" or ".\ibdata1". -let SEARCH_PATTERN=redo rollback segment.*found.*redo rollback segment.*active ---source include/search_pattern_in_file.inc -let SEARCH_PATTERN=non-redo rollback.*active ---source include/search_pattern_in_file.inc - - -SHOW TABLES; - --- disable_query_log -eval set global innodb_file_per_table=$innodb_file_per_table_orig; --- enable_query_log - diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 03fba3fde49..eea7f19d1f5 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7438,3 +7438,5 @@ ER_JSON_PATH_ARRAY eng "JSON path should end with an array identifier in argument %d to function '%s'" ER_JSON_ONE_OR_ALL eng "Argument 2 to function '%s' must be "one" or "all"." +ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE + eng "CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE." diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index f150a98e6ef..4bebb9ee7dd 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -335,8 +335,7 @@ btr_root_adjust_on_import( } else { /* Check that the table flags and the tablespace flags match. */ - ulint flags = dict_tf_to_fsp_flags( - table->flags, false); + ulint flags = dict_tf_to_fsp_flags(table->flags); ulint fsp_flags = fil_space_get_flags(table->space); err = flags == fsp_flags ? DB_SUCCESS : DB_CORRUPTION; diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 87d88cea820..4d0499418a2 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -3048,12 +3048,12 @@ fail_err: if (*rec) { } else if (page_size.is_compressed()) { + ut_ad(!dict_table_is_temporary(index->table)); /* Reset the IBUF_BITMAP_FREE bits, because page_cur_tuple_insert() will have attempted page reorganize before failing. */ if (leaf - && !dict_index_is_clust(index) - && !dict_table_is_temporary(index->table)) { + && !dict_index_is_clust(index)) { ibuf_reset_free_bits(block); } @@ -3649,6 +3649,8 @@ btr_cur_update_in_place( /* Check that enough space is available on the compressed page. */ if (page_zip) { + ut_ad(!dict_table_is_temporary(index->table)); + if (!btr_cur_update_alloc_zip( page_zip, btr_cur_get_page_cur(cursor), index, offsets, rec_offs_size(offsets), @@ -3725,9 +3727,9 @@ func_exit: if (page_zip && !(flags & BTR_KEEP_IBUF_BITMAP) && !dict_index_is_clust(index) - && !dict_table_is_temporary(index->table) && page_is_leaf(buf_block_get_frame(block))) { /* Update the free bits in the insert buffer. */ + ut_ad(!dict_table_is_temporary(index->table)); ibuf_update_free_bits_zip(block, mtr); } @@ -3876,6 +3878,8 @@ any_extern: #endif /* UNIV_ZIP_DEBUG */ if (page_zip) { + ut_ad(!dict_table_is_temporary(index->table)); + if (page_zip_rec_needs_ext(new_rec_size, page_is_comp(page), dict_index_get_n_fields(index), dict_table_page_size(index->table))) { @@ -3994,12 +3998,12 @@ any_extern: func_exit: if (!(flags & BTR_KEEP_IBUF_BITMAP) - && !dict_index_is_clust(index) - && !dict_table_is_temporary(index->table)) { + && !dict_index_is_clust(index)) { /* Update the free bits in the insert buffer. */ if (page_zip) { + ut_ad(!dict_table_is_temporary(index->table)); ibuf_update_free_bits_zip(block, mtr); - } else { + } else if (!dict_table_is_temporary(index->table)) { ibuf_update_free_bits_low(block, max_ins_size, mtr); } } @@ -4123,6 +4127,7 @@ btr_cur_pessimistic_update( #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ + ut_ad(!page_zip || !dict_table_is_temporary(index->table)); /* The insert buffer tree should never be updated in place. */ ut_ad(!dict_index_is_ibuf(index)); ut_ad(trx_id > 0 @@ -4153,8 +4158,8 @@ btr_cur_pessimistic_update( if (page_zip && optim_err != DB_ZIP_OVERFLOW && !dict_index_is_clust(index) - && !dict_table_is_temporary(index->table) && page_is_leaf(page)) { + ut_ad(!dict_table_is_temporary(index->table)); ibuf_update_free_bits_zip(block, mtr); } @@ -4327,14 +4332,14 @@ btr_cur_pessimistic_update( page_cursor->rec, index, *offsets); } } else if (!dict_index_is_clust(index) - && !dict_table_is_temporary(index->table) && page_is_leaf(page)) { /* Update the free bits in the insert buffer. This is the same block which was skipped by BTR_KEEP_IBUF_BITMAP. */ if (page_zip) { + ut_ad(!dict_table_is_temporary(index->table)); ibuf_update_free_bits_zip(block, mtr); - } else { + } else if (!dict_table_is_temporary(index->table)) { ibuf_update_free_bits_low(block, max_ins_size, mtr); } diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 44624f6b654..c5d8e7ee21f 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -404,6 +404,7 @@ dict_build_tablespace_for_table( DICT_TF2_FTS_AUX_HEX_NAME);); if (needs_file_per_table) { + ut_ad(!dict_table_is_temporary(table)); /* This table will need a new tablespace. */ ut_ad(dict_table_get_format(table) <= UNIV_FORMAT_MAX); @@ -424,21 +425,10 @@ dict_build_tablespace_for_table( table->space = static_cast(space); /* Determine the tablespace flags. */ - bool is_temp = dict_table_is_temporary(table); bool has_data_dir = DICT_TF_HAS_DATA_DIR(table->flags); - ulint fsp_flags = dict_tf_to_fsp_flags(table->flags, - is_temp); + ulint fsp_flags = dict_tf_to_fsp_flags(table->flags); - /* Determine the full filepath */ - if (is_temp) { - /* Temporary table filepath contains a full path - and a filename without the extension. */ - ut_ad(table->dir_path_of_temp_table); - filepath = fil_make_filepath( - table->dir_path_of_temp_table, - NULL, IBD, false); - - } else if (has_data_dir) { + if (has_data_dir) { ut_ad(table->data_dir_path); filepath = fil_make_filepath( table->data_dir_path, @@ -474,7 +464,6 @@ dict_build_tablespace_for_table( mtr_start(&mtr); mtr.set_named_space(table->space); - dict_disable_redo_if_temporary(table, &mtr); bool ret = fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 58d5870bf95..3cf236e643b 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1696,25 +1696,17 @@ dict_table_rename_in_cache( ib::info() << "Delete of " << filepath << " failed."; } - ut_free(filepath); } else if (dict_table_is_file_per_table(table)) { - if (table->dir_path_of_temp_table != NULL) { - ib::error() << "Trying to rename a TEMPORARY TABLE " - << old_name - << " ( " << table->dir_path_of_temp_table - << " )"; - return(DB_ERROR); - } - char* new_path = NULL; char* old_path = fil_space_get_first_path(table->space); + ut_ad(!dict_table_is_temporary(table)); + if (DICT_TF_HAS_DATA_DIR(table->flags)) { new_path = os_file_make_new_pathname( old_path, new_name); - err = RemoteDatafile::create_link_file( new_name, new_path); @@ -7254,12 +7246,9 @@ Other bits are the same. dict_table_t::flags | 0 | 1 | 1 | 1 fil_space_t::flags | 0 | 0 | 1 | 1 @param[in] table_flags dict_table_t::flags -@param[in] is_temp whether the tablespace is temporary @return tablespace flags (fil_space_t::flags) */ ulint -dict_tf_to_fsp_flags( - ulint table_flags, - bool is_temp) +dict_tf_to_fsp_flags(ulint table_flags) { DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure", return(ULINT_UNDEFINED);); @@ -7276,7 +7265,6 @@ dict_tf_to_fsp_flags( ulint fsp_flags = fsp_flags_init(page_size, has_atomic_blobs, has_data_dir, - is_temp, 0, 0, 0); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index a3da3a755d6..756e1010d66 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1239,8 +1239,7 @@ dict_check_sys_tables( char* filepath = dict_get_first_path(space_id); /* Check that the .ibd file exists. */ - bool is_temp = flags2 & DICT_TF2_TEMPORARY; - ulint fsp_flags = dict_tf_to_fsp_flags(flags, is_temp); + ulint fsp_flags = dict_tf_to_fsp_flags(flags); validate = true; /* Encryption */ dberr_t err = fil_ibd_open( @@ -2513,9 +2512,9 @@ dict_get_and_save_data_dir_path( dict_table_t* table, bool dict_mutex_own) { - bool is_temp = DICT_TF2_FLAG_IS_SET(table, DICT_TF2_TEMPORARY); + ut_ad(!dict_table_is_temporary(table)); - if (!is_temp && !table->data_dir_path && table->space) { + if (!table->data_dir_path && table->space) { char* path = fil_space_get_first_path(table->space); if (!dict_mutex_own) { @@ -2610,6 +2609,8 @@ dict_load_tablespace( mem_heap_t* heap, dict_err_ignore_t ignore_err) { + ut_ad(!dict_table_is_temporary(table)); + /* The system tablespace is always available. */ if (is_system_tablespace(table->space)) { return; @@ -2622,12 +2623,6 @@ dict_load_tablespace( return; } - if (dict_table_is_temporary(table)) { - /* Do not bother to retry opening temporary tables. */ - table->ibd_file_missing = TRUE; - return; - } - char* space_name = table->name.m_name; /* The tablespace may already be open. */ @@ -2662,7 +2657,7 @@ dict_load_tablespace( /* Try to open the tablespace. We set the 2nd param (fix_dict) to false because we do not have an x-lock on dict_operation_lock */ - ulint fsp_flags = dict_tf_to_fsp_flags(table->flags, false); + ulint fsp_flags = dict_tf_to_fsp_flags(table->flags); dberr_t err = fil_ibd_open( true, false, FIL_TYPE_TABLESPACE, table->space, fsp_flags, space_name, filepath, table); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 331fc34e603..bfae83af3df 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -215,12 +215,13 @@ fil_space_belongs_in_lru( const fil_space_t* space) /*!< in: file space */ { switch (space->purpose) { + case FIL_TYPE_TEMPORARY: case FIL_TYPE_LOG: return(false); case FIL_TYPE_TABLESPACE: - case FIL_TYPE_TEMPORARY: - case FIL_TYPE_IMPORT: return(fil_is_user_tablespace_id(space->id)); + case FIL_TYPE_IMPORT: + return(true); } ut_ad(0); @@ -3711,7 +3712,7 @@ func_exit: return(success); } -/** Create a new General or Single-Table tablespace +/** Create a tablespace file. @param[in] space_id Tablespace ID @param[in] name Tablespace name in dbname/tablename format. @param[in] path Path and filename of the datafile to create. @@ -3736,7 +3737,6 @@ fil_ibd_create( byte* buf2; byte* page; bool success; - bool is_temp = FSP_FLAGS_GET_TEMPORARY(flags); bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags); fil_space_t* space = NULL; fil_space_crypt_t *crypt_data = NULL; @@ -3926,21 +3926,16 @@ fil_ibd_create( crypt_data = fil_space_create_crypt_data(mode, key_id); } - space = fil_space_create(name, space_id, flags, is_temp - ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, + space = fil_space_create(name, space_id, flags, FIL_TYPE_TABLESPACE, crypt_data, true); if (!fil_node_create_low(path, size, space, false, true)) { - if (crypt_data) { free(crypt_data); } err = DB_ERROR; - goto error_exit_1; - } - - if (!is_temp) { + } else { mtr_t mtr; const fil_node_t* file = UT_LIST_GET_FIRST(space->chain); @@ -3950,20 +3945,14 @@ fil_ibd_create( NULL, space->flags, &mtr); fil_name_write(space, 0, file, &mtr); mtr_commit(&mtr); - } - - err = DB_SUCCESS; - - /* Error code is set. Cleanup the various variables used. - These labels reflect the order in which variables are assigned or - actions are done. */ -error_exit_1: - if (err != DB_SUCCESS && has_data_dir) { - RemoteDatafile::delete_link_file(name); + err = DB_SUCCESS; } os_file_close(file); if (err != DB_SUCCESS) { + if (has_data_dir) { + RemoteDatafile::delete_link_file(name); + } os_file_delete(innodb_data_file_key, path); } @@ -4596,10 +4585,8 @@ fil_ibd_load( ut_ad(space == NULL); - bool is_temp = FSP_FLAGS_GET_TEMPORARY(file.flags()); space = fil_space_create( - file.name(), space_id, file.flags(), - is_temp ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, + file.name(), space_id, file.flags(), FIL_TYPE_TABLESPACE, file.get_crypt_info(), false); if (space == NULL) { @@ -4668,10 +4655,7 @@ fil_report_missing_tablespace( << " in the InnoDB data dictionary has tablespace id " << space_id << "," " but tablespace with that id or name does not exist. Have" - " you deleted or moved .ibd files? This may also be a table" - " created with CREATE TEMPORARY TABLE whose .ibd and .frm" - " files MySQL automatically removed, but the table still" - " exists in the InnoDB internal data dictionary."; + " you deleted or moved .ibd files?"; } /** Returns true if a matching tablespace exists in the InnoDB tablespace diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc index 00b5c37cec4..afd4ba9dddc 100644 --- a/storage/innobase/fsp/fsp0file.cc +++ b/storage/innobase/fsp/fsp0file.cc @@ -550,7 +550,10 @@ Datafile::validate_first_page(lsn_t* flush_lsn, free_first_page(); return(DB_ERROR); - + } else if (!fsp_flags_is_valid(m_flags) + || FSP_FLAGS_GET_TEMPORARY(m_flags)) { + /* Tablespace flags must be valid. */ + error_txt = "Tablespace flags are invalid"; } else if (page_get_page_no(m_first_page) != 0) { /* First page must be number 0 */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 56b1f968244..db1d90c06fe 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4098,7 +4098,7 @@ innobase_init( /* Create the filespace flags. */ fsp_flags = fsp_flags_init( - univ_page_size, false, false, false, false, 0, 0); + univ_page_size, false, false, false, 0, 0); srv_sys_space.set_flags(fsp_flags); srv_sys_space.set_name("innodb_system"); @@ -4124,7 +4124,7 @@ innobase_init( /* Create the filespace flags with the temp flag set. */ fsp_flags = fsp_flags_init( - univ_page_size, false, false, true, false, 0, 0); + univ_page_size, false, false, false, 0, 0); srv_tmp_space.set_flags(fsp_flags); if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) { @@ -11755,11 +11755,6 @@ create_table_info_t::create_table_def() ? doc_id_col : n_cols - num_v; } - if (strlen(m_temp_path) != 0) { - table->dir_path_of_temp_table = - mem_heap_strdup(table->heap, m_temp_path); - } - if (DICT_TF_HAS_DATA_DIR(m_flags)) { ut_a(strlen(m_remote_path)); @@ -12271,9 +12266,10 @@ create_table_info_t::create_options_are_invalid() const char* ret = NULL; enum row_type row_format = m_create_info->row_type; + const bool is_temp + = m_create_info->options & HA_LEX_CREATE_TMP_TABLE; ut_ad(m_thd != NULL); - ut_ad(m_create_info != NULL); /* If innodb_strict_mode is not set don't do any more validation. */ if (!THDVAR(m_thd, strict_mode)) { @@ -12282,6 +12278,12 @@ create_table_info_t::create_options_are_invalid() /* Check if a non-zero KEY_BLOCK_SIZE was specified. */ if (has_key_block_size) { + if (is_temp) { + my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE, + MYF(0)); + return("KEY_BLOCK_SIZE"); + } + switch (m_create_info->key_block_size) { ulint kbs_max; case 1: @@ -12341,6 +12343,11 @@ create_table_info_t::create_options_are_invalid() other incompatibilities. */ switch (row_format) { case ROW_TYPE_COMPRESSED: + if (is_temp) { + my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE, + MYF(0)); + return("ROW_FORMAT"); + } if (!m_allow_file_per_table) { push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, @@ -12361,7 +12368,7 @@ create_table_info_t::create_options_are_invalid() } break; case ROW_TYPE_DYNAMIC: - if (!m_allow_file_per_table) { + if (!m_allow_file_per_table && !is_temp) { push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, @@ -12370,7 +12377,7 @@ create_table_info_t::create_options_are_invalid() get_row_format_name(row_format)); ret = "ROW_FORMAT"; } - if (srv_file_format < UNIV_FORMAT_B) { + if (!is_temp && srv_file_format < UNIV_FORMAT_B) { push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, @@ -12595,6 +12602,10 @@ ha_innobase::update_create_info( create_info->auto_increment_value = stats.auto_increment_value; } + if (dict_table_is_temporary(m_prebuilt->table)) { + return; + } + /* Update the DATA DIRECTORY name from SYS_DATAFILES. */ dict_get_and_save_data_dir_path(m_prebuilt->table, false); @@ -12619,8 +12630,7 @@ innobase_fts_load_stopword( THDVAR(thd, ft_enable_stopword), FALSE)); } -/** Parse the table name into normal name and either temp path or remote path -if needed. +/** Parse the table name into normal name and remote path if needed. @param[in] name Table name (db/table or full path). @return 0 if successful, otherwise, error number */ int @@ -12653,17 +12663,8 @@ create_table_info_t::parse_table_name( } #endif - m_temp_path[0] = '\0'; m_remote_path[0] = '\0'; - /* A full path is provided by the server for TEMPORARY tables not - targeted for a tablespace or when DATA DIRECTORY is given. - So these two are not compatible. Likewise, DATA DIRECTORY is not - compatible with a TABLESPACE assignment. */ - if ((m_create_info->options & HA_LEX_CREATE_TMP_TABLE)) { - strncpy(m_temp_path, name, FN_REFLEN - 1); - } - /* Make sure DATA DIRECTORY is compatible with other options and set the remote path. In the case of either; CREATE TEMPORARY TABLE ... DATA DIRECTORY={path} ... ; @@ -12703,11 +12704,14 @@ create_table_info_t::innobase_table_flags() DBUG_ENTER("innobase_table_flags"); const char* fts_doc_id_index_bad = NULL; - bool zip_allowed = true; ulint zip_ssize = 0; enum row_type row_type; rec_format_t innodb_row_format = get_row_format(innodb_default_row_format); + const bool is_temp + = m_create_info->options & HA_LEX_CREATE_TMP_TABLE; + bool zip_allowed + = !is_temp; const ulint zip_ssize_max = ut_min(static_cast(UNIV_PAGE_SSIZE_MAX), @@ -12735,8 +12739,7 @@ create_table_info_t::innobase_table_flags() /* We don't support FTS indexes in temporary tables. */ - if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) { - + if (is_temp) { my_error(ER_INNODB_NO_FT_TEMP_TABLE, MYF(0)); DBUG_RETURN(false); } @@ -12744,12 +12747,6 @@ create_table_info_t::innobase_table_flags() if (fts_doc_id_index_bad) { goto index_bad; } - } else if (key->flags & HA_SPATIAL) { - if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE - && !m_use_file_per_table) { - my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0)); - DBUG_RETURN(false); - } } if (innobase_strcasecmp(key->name, FTS_DOC_ID_INDEX_NAME)) { @@ -12789,7 +12786,14 @@ index_bad: } /* Make sure compressed row format is allowed. */ - if (!m_allow_file_per_table) { + if (is_temp) { + push_warning( + m_thd, Sql_condition::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE is ignored" + " for TEMPORARY TABLE."); + zip_allowed = false; + } else if (!m_allow_file_per_table) { push_warning( m_thd, Sql_condition::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, @@ -12859,9 +12863,14 @@ index_bad: innodb_row_format = REC_FORMAT_COMPACT; break; case ROW_TYPE_COMPRESSED: - /* ROW_FORMAT=COMPRESSED requires file_per_table and - file_format=Barracuda unless there is a target tablespace. */ - if (!m_allow_file_per_table) { + if (is_temp) { + push_warning_printf( + m_thd, Sql_condition::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ROW_FORMAT=%s is ignored for" + " TEMPORARY TABLE.", + get_row_format_name(row_type)); + } else if (!m_allow_file_per_table) { push_warning_printf( m_thd, Sql_condition::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, @@ -12874,20 +12883,9 @@ index_bad: ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: ROW_FORMAT=COMPRESSED requires" " innodb_file_format > Antelope."); - } else { - switch(row_type) { - case ROW_TYPE_COMPRESSED: - innodb_row_format = REC_FORMAT_COMPRESSED; - break; - case ROW_TYPE_DYNAMIC: - innodb_row_format = REC_FORMAT_DYNAMIC; - break; - default: - /* Not possible, avoid compiler warning */ - break; - } - break; /* Correct row_format */ + innodb_row_format = REC_FORMAT_COMPRESSED; + break; } zip_allowed = false; /* fall through to set row_type = DYNAMIC */ @@ -12915,13 +12913,18 @@ index_bad: zip_allowed = false; } + ut_ad(!is_temp || !zip_allowed); + ut_ad(!is_temp || innodb_row_format != REC_FORMAT_COMPRESSED); + /* Set the table flags */ if (!zip_allowed) { zip_ssize = 0; } - if (m_create_info->options & HA_LEX_CREATE_TMP_TABLE) { + if (is_temp) { m_flags2 |= DICT_TF2_TEMPORARY; + } else if (m_use_file_per_table) { + m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE; } /* Set the table flags */ @@ -12932,10 +12935,6 @@ index_bad: default_compression_level : options->page_compression_level, 0); - if (m_use_file_per_table) { - m_flags2 |= DICT_TF2_USE_FILE_PER_TABLE; - } - /* Set the flags2 when create table or alter tables */ m_flags2 |= DICT_TF2_FTS_AUX_HEX_NAME; DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name", @@ -13125,24 +13124,16 @@ create_table_info_t::set_tablespace_type( m_innodb_file_per_table || table_being_altered_is_file_per_table; - /* All noncompresed temporary tables will be put into the - system temporary tablespace. */ - bool is_noncompressed_temporary = - m_create_info->options & HA_LEX_CREATE_TMP_TABLE - && !(m_create_info->row_type == ROW_TYPE_COMPRESSED - || m_create_info->key_block_size > 0); - /* Ignore the current innodb-file-per-table setting if we are - creating a temporary, non-compressed table. */ + creating a temporary table. */ m_use_file_per_table = m_allow_file_per_table - && !is_noncompressed_temporary; + && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE); /* DATA DIRECTORY must have m_use_file_per_table but cannot be used with TEMPORARY tables. */ m_use_data_dir = m_use_file_per_table - && !(m_create_info->options & HA_LEX_CREATE_TMP_TABLE) && (m_create_info->data_file_name != NULL) && (m_create_info->data_file_name[0] != '\0'); } @@ -13570,7 +13561,6 @@ ha_innobase::create( { int error; char norm_name[FN_REFLEN]; /* {database}/{tablename} */ - char temp_path[FN_REFLEN]; /* Absolute path of temp frm */ char remote_path[FN_REFLEN]; /* Absolute path of table */ trx_t* trx; DBUG_ENTER("ha_innobase::create"); @@ -13579,7 +13569,6 @@ ha_innobase::create( form, create_info, norm_name, - temp_path, remote_path); /* Initialize the object. */ diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 066eff12ca9..d11d5913f34 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2016, MariaDB Corporation. +Copyright (c) 2013, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -688,13 +688,11 @@ public: TABLE* form, HA_CREATE_INFO* create_info, char* table_name, - char* temp_path, char* remote_path) :m_thd(thd), m_form(form), m_create_info(create_info), m_table_name(table_name), - m_temp_path(temp_path), m_remote_path(remote_path), m_innodb_file_per_table(srv_file_per_table) {} @@ -804,12 +802,6 @@ private: /** Table name */ char* m_table_name; - /** If this is a table explicitly created by the user with the - TEMPORARY keyword, then this parameter is the dir path where the - table should be placed if we create an .ibd file for it - (no .ibd extension in the path, though). - Otherwise this is a zero length-string */ - char* m_temp_path; /** Remote path (DATA DIRECTORY) or zero length-string */ char* m_remote_path; diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc index 80f3b410ee7..6cdbd226b24 100644 --- a/storage/innobase/handler/ha_innopart.cc +++ b/storage/innobase/handler/ha_innopart.cc @@ -2607,8 +2607,6 @@ ha_innopart::create( int error; /** {database}/{tablename} */ char table_name[FN_REFLEN]; - /** absolute path of temp frm */ - char temp_path[FN_REFLEN]; /** absolute path of table */ char remote_path[FN_REFLEN]; char partition_name[FN_REFLEN]; @@ -2623,7 +2621,6 @@ ha_innopart::create( form, create_info, table_name, - temp_path, remote_path); DBUG_ENTER("ha_innopart::create"); @@ -2649,7 +2646,6 @@ ha_innopart::create( if (error != 0) { DBUG_RETURN(error); } - ut_ad(temp_path[0] == '\0'); strcpy(partition_name, table_name); partition_name_start = partition_name + strlen(partition_name); table_name_len = strlen(table_name); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 8ba9f6cb175..341c341f112 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -5588,7 +5588,6 @@ ha_innobase::prepare_inplace_alter_table( altered_table, ha_alter_info->create_info, NULL, - NULL, NULL); info.set_tablespace_type(indexed_table->space != TRX_SYS_SPACE); diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index a7fe80e447d..349b105be6a 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1036,12 +1036,9 @@ dict_table_t::flags | 0 | 1 | 1 | 1 fil_space_t::flags | 0 | 0 | 1 | 1 ================================================================== @param[in] table_flags dict_table_t::flags -@param[in] is_temp whether the tablespace is temporary @return tablespace flags (fil_space_t::flags) */ ulint -dict_tf_to_fsp_flags( - ulint table_flags, - bool is_temp) +dict_tf_to_fsp_flags(ulint table_flags) MY_ATTRIBUTE((const)); /** Extract the page size from table flags. diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 6717e7085c2..ccfc46f7941 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1375,12 +1375,6 @@ struct dict_table_t { /** Table name. */ table_name_t name; - /** NULL or the directory path where a TEMPORARY table that was - explicitly created by a user should be placed if innodb_file_per_table - is defined in my.cnf. In Unix this is usually "/tmp/...", - in Windows "temp\...". */ - const char* dir_path_of_temp_table; - /** NULL or the directory path specified by DATA DIRECTORY. */ char* data_dir_path; diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index eebe21d85bf..3d786764148 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -956,13 +956,15 @@ fil_make_filepath( ib_extention suffix, bool strip_name); -/** Creates a new General or Single-Table tablespace +/** Create a tablespace file. @param[in] space_id Tablespace ID @param[in] name Tablespace name in dbname/tablename format. @param[in] path Path and filename of the datafile to create. @param[in] flags Tablespace flags @param[in] size Initial size of the tablespace file in pages, must be >= FIL_IBD_FILE_INITIAL_SIZE +@param[in] mode MariaDB encryption mode +@param[in] key_id MariaDB encryption key_id @return DB_SUCCESS or error code */ dberr_t fil_ibd_create( @@ -971,8 +973,8 @@ fil_ibd_create( const char* path, ulint flags, ulint size, - fil_encryption_t mode, /*!< in: encryption mode */ - ulint key_id) /*!< in: encryption key_id */ + fil_encryption_t mode, + ulint key_id) MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 129842982a3..878929c085c 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -648,7 +648,9 @@ fsp_flags_is_compressed( @param[in] page_size page sizes in bytes and compression flag. @param[in] atomic_blobs Used by Dynammic and Compressed. @param[in] has_data_dir This tablespace is in a remote location. -@param[in] is_temporary This tablespace is temporary. +@param[in] page_compressed Table uses page compression +@param[in] page_compression_level Page compression level +@param[in] not_used For future @return tablespace flags after initialization */ UNIV_INLINE ulint @@ -656,7 +658,6 @@ fsp_flags_init( const page_size_t& page_size, bool atomic_blobs, bool has_data_dir, - bool is_temporary, bool page_compression, ulint page_compression_level, ulint not_used); diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic index 9ff2dab75d4..6d0d6f05a9f 100644 --- a/storage/innobase/include/fsp0fsp.ic +++ b/storage/innobase/include/fsp0fsp.ic @@ -145,7 +145,6 @@ fsp_flags_set_page_size( @param[in] page_size page sizes in bytes and compression flag. @param[in] atomic_blobs Used by Dynammic and Compressed. @param[in] has_data_dir This tablespace is in a remote location. -@param[in] is_temporary This tablespace is temporary. @param[in] page_compressed Table uses page compression @param[in] page_compression_level Page compression level @param[in] not_used For future @@ -156,7 +155,6 @@ fsp_flags_init( const page_size_t& page_size, bool atomic_blobs, bool has_data_dir, - bool is_temporary, bool page_compression, ulint page_compression_level, ulint not_used) @@ -181,11 +179,6 @@ fsp_flags_init( flags |= FSP_FLAGS_MASK_DATA_DIR; } - if (is_temporary) { - ut_ad(!has_data_dir); - flags |= FSP_FLAGS_MASK_TEMPORARY; - } - /* In addition, tablespace flags also contain if the page compression is used for this table. */ if (page_compression) { diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 67482db160a..4c272d96a39 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -481,11 +481,6 @@ row_drop_table_for_mysql( bool nonatomic = true); /*!< in: whether it is permitted to release and reacquire dict_operation_lock */ -/*********************************************************************//** -Drop all temporary tables during crash recovery. */ -void -row_mysql_drop_temp_tables(void); -/*============================*/ /*********************************************************************//** Discards the tablespace of a table which stored in an .ibd file. Discarding diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index e2f5265261b..e5aab543f5d 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3535,8 +3535,6 @@ recv_recovery_rollback_active(void) /* Drop partially created indexes. */ row_merge_drop_temp_indexes(); - /* Drop temporary tables. */ - row_mysql_drop_temp_tables(); /* Drop any auxiliary tables that were not dropped when the parent table was dropped. This can happen if the parent table diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 704ed55f2b3..e2d2dd40fd8 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -550,6 +550,7 @@ page_create_empty( } if (page_zip) { + ut_ad(!dict_table_is_temporary(index->table)); page_create_zip(block, index, page_header_get_field(page, PAGE_LEVEL), max_trx_id, NULL, mtr); diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index c47a1905b4b..35ef24c16a6 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -4688,6 +4688,7 @@ page_zip_reorganize( ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); ut_ad(page_is_comp(page)); ut_ad(!dict_index_is_ibuf(index)); + ut_ad(!dict_table_is_temporary(index->table)); /* Note that page_zip_validate(page_zip, page, index) may fail here. */ UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); @@ -4719,7 +4720,6 @@ page_zip_reorganize( temp_page + (PAGE_HEADER + PAGE_MAX_TRX_ID), 8); /* PAGE_MAX_TRX_ID must be set on secondary index leaf pages. */ ut_ad(dict_index_is_clust(index) || !page_is_leaf(temp_page) - || dict_table_is_temporary(index->table) || page_get_max_trx_id(page) != 0); /* PAGE_MAX_TRX_ID must be zero on non-leaf pages other than clustered index root pages. */ @@ -4764,6 +4764,7 @@ page_zip_copy_recs( ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(mtr_memo_contains_page(mtr, src, MTR_MEMO_PAGE_X_FIX)); ut_ad(!dict_index_is_ibuf(index)); + ut_ad(!dict_table_is_temporary(index->table)); #ifdef UNIV_ZIP_DEBUG /* The B-tree operations that call this function may set FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag @@ -4807,8 +4808,7 @@ page_zip_copy_recs( } else { /* The PAGE_MAX_TRX_ID must be nonzero on leaf pages of secondary indexes, and 0 on others. */ - ut_ad(dict_table_is_temporary(index->table) - || !page_is_leaf(src) == !page_get_max_trx_id(src)); + ut_ad(!page_is_leaf(src) == !page_get_max_trx_id(src)); } /* Copy all fields of src_zip to page_zip, except the pointer diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 88a4ce8b7d7..554455509a7 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3604,7 +3604,7 @@ row_import_for_mysql( we will not be writing any redo log for it before we have invoked fil_space_set_imported() to declare it a persistent tablespace. */ - ulint fsp_flags = dict_tf_to_fsp_flags(table->flags, false); + ulint fsp_flags = dict_tf_to_fsp_flags(table->flags); err = fil_ibd_open( true, true, FIL_TYPE_IMPORT, table->space, diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 0bc4fe4def9..187dd06acf1 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3546,36 +3546,25 @@ This deletes the fil_space_t if found and the file on disk. @param[in] space_id Tablespace ID @param[in] tablename Table name, same as the tablespace name @param[in] filepath File path of tablespace to delete -@param[in] is_temp Is this a temporary table/tablespace -@param[in] trx Transaction handle @return error code or DB_SUCCESS */ UNIV_INLINE dberr_t row_drop_single_table_tablespace( ulint space_id, const char* tablename, - const char* filepath, - bool is_temp, - trx_t* trx) + const char* filepath) { dberr_t err = DB_SUCCESS; - /* This might be a temporary single-table tablespace if the table - is compressed and temporary. If so, don't spam the log when we - delete one of these or if we can't find the tablespace. */ - bool print_msg = !is_temp; - /* If the tablespace is not in the cache, just delete the file. */ if (!fil_space_for_table_exists_in_mem( - space_id, tablename, print_msg, false, NULL, 0, NULL)) { + space_id, tablename, true, false, NULL, 0, NULL)) { /* Force a delete of any discarded or temporary files. */ fil_delete_file(filepath); - if (print_msg) { - ib::info() << "Removed datafile " << filepath - << " for table " << tablename; - } + ib::info() << "Removed datafile " << filepath + << " for table " << tablename; } else if (fil_delete_tablespace(space_id, BUF_REMOVE_FLUSH_NO_WRITE) != DB_SUCCESS) { @@ -4042,12 +4031,12 @@ row_drop_table_for_mysql( /* remove the index object associated. */ dict_drop_index_tree_in_mem(index, *page_no++); } - err = DB_SUCCESS; + err = row_drop_table_from_cache(tablename, table, trx); + goto funct_exit; } switch (err) { ulint space_id; - bool is_temp; bool ibd_file_missing; bool is_discarded; @@ -4055,18 +4044,7 @@ row_drop_table_for_mysql( space_id = table->space; ibd_file_missing = table->ibd_file_missing; is_discarded = dict_table_is_discarded(table); - is_temp = dict_table_is_temporary(table); - - /* If there is a temp path then the temp flag is set. - However, during recovery, we might have a temp flag but - not know the temp path */ - ut_a(table->dir_path_of_temp_table == NULL || is_temp); - - /* We do not allow temporary tables with a remote path. */ - ut_a(!(is_temp && DICT_TF_HAS_DATA_DIR(table->flags))); - - /* Make sure the data_dir_path is set if needed. */ - dict_get_and_save_data_dir_path(table, true); + ut_ad(!dict_table_is_temporary(table)); err = row_drop_ancillary_fts_tables(table, trx); if (err != DB_SUCCESS) { @@ -4076,14 +4054,11 @@ row_drop_table_for_mysql( /* Determine the tablespace filename before we drop dict_table_t. Free this memory before returning. */ if (DICT_TF_HAS_DATA_DIR(table->flags)) { + dict_get_and_save_data_dir_path(table, true); ut_a(table->data_dir_path); filepath = fil_make_filepath( table->data_dir_path, table->name.m_name, IBD, true); - } else if (table->dir_path_of_temp_table) { - filepath = fil_make_filepath( - table->dir_path_of_temp_table, - NULL, IBD, false); } else { filepath = fil_make_filepath( NULL, table->name.m_name, IBD, false); @@ -4104,8 +4079,7 @@ row_drop_table_for_mysql( /* We can now drop the single-table tablespace. */ err = row_drop_single_table_tablespace( - space_id, tablename, filepath, - is_temp, trx); + space_id, tablename, filepath); break; case DB_OUT_OF_FILE_SPACE: @@ -4187,99 +4161,6 @@ funct_exit: DBUG_RETURN(err); } -/*********************************************************************//** -Drop all temporary tables during crash recovery. */ -void -row_mysql_drop_temp_tables(void) -/*============================*/ -{ - trx_t* trx; - btr_pcur_t pcur; - mtr_t mtr; - mem_heap_t* heap; - - trx = trx_allocate_for_background(); - trx->op_info = "dropping temporary tables"; - row_mysql_lock_data_dictionary(trx); - - heap = mem_heap_create(200); - - mtr_start(&mtr); - - btr_pcur_open_at_index_side( - true, - dict_table_get_first_index(dict_sys->sys_tables), - BTR_SEARCH_LEAF, &pcur, true, 0, &mtr); - - for (;;) { - const rec_t* rec; - const byte* field; - ulint len; - const char* table_name; - dict_table_t* table; - - btr_pcur_move_to_next_user_rec(&pcur, &mtr); - - if (!btr_pcur_is_on_user_rec(&pcur)) { - break; - } - - /* The high order bit of N_COLS is set unless - ROW_FORMAT=REDUNDANT. */ - rec = btr_pcur_get_rec(&pcur); - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLES__NAME, &len); - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLES__N_COLS, &len); - if (len != 4 - || !(mach_read_from_4(field) & DICT_N_COLS_COMPACT)) { - continue; - } - - /* Older versions of InnoDB, which only supported tables - in ROW_FORMAT=REDUNDANT could write garbage to - SYS_TABLES.MIX_LEN, where we now store the is_temp flag. - Above, we assumed is_temp=0 if ROW_FORMAT=REDUNDANT. */ - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLES__MIX_LEN, &len); - if (len != 4 - || !(mach_read_from_4(field) & DICT_TF2_TEMPORARY)) { - continue; - } - - /* This is a temporary table. */ - field = rec_get_nth_field_old( - rec, DICT_FLD__SYS_TABLES__NAME, &len); - if (len == UNIV_SQL_NULL || len == 0) { - /* Corrupted SYS_TABLES.NAME */ - continue; - } - - table_name = mem_heap_strdupl(heap, (const char*) field, len); - - btr_pcur_store_position(&pcur, &mtr); - btr_pcur_commit_specify_mtr(&pcur, &mtr); - - table = dict_load_table(table_name, true, - DICT_ERR_IGNORE_NONE); - - if (table) { - row_drop_table_for_mysql(table_name, trx, FALSE, FALSE); - trx_commit_for_mysql(trx); - } - - mtr_start(&mtr); - btr_pcur_restore_position(BTR_SEARCH_LEAF, - &pcur, &mtr); - } - - btr_pcur_close(&pcur); - mtr_commit(&mtr); - mem_heap_free(heap); - row_mysql_unlock_data_dictionary(trx); - trx_free_for_background(trx); -} - /*******************************************************************//** Drop all foreign keys in a database, see Bug#18942. Called at the end of row_drop_database_for_mysql(). diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index b372da4b939..094c0b45e6d 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -1993,9 +1993,9 @@ row_truncate_table_for_mysql( return(row_truncate_complete( table, trx, fsp_flags, logger, err)); } - } else { /* For temporary tables we don't have entries in SYSTEM TABLES*/ + ut_ad(fsp_is_system_temporary(table->space)); for (dict_index_t* index = UT_LIST_GET_FIRST(table->indexes); index != NULL; index = UT_LIST_GET_NEXT(indexes, index)) { @@ -2018,10 +2018,7 @@ row_truncate_table_for_mysql( } } - if (is_file_per_table - && !dict_table_is_temporary(table) - && fsp_flags != ULINT_UNDEFINED) { - + if (is_file_per_table && fsp_flags != ULINT_UNDEFINED) { fil_reinit_space_header( table->space, table->indexes.count + FIL_IBD_FILE_INITIAL_SIZE + 1); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index ddc766accd4..d0b7ddc0449 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -692,7 +692,7 @@ srv_undo_tablespace_open( /* Set the compressed page size to 0 (non-compressed) */ flags = fsp_flags_init( - univ_page_size, false, false, false, false, 0, 0); + univ_page_size, false, false, false, 0, 0); space = fil_space_create( undo_name, space_id, flags, FIL_TYPE_TABLESPACE, NULL, true);