| 1 |
# |
| 2 |
# WL#6469: Optimizing CREATE/DROP performance for temporary tables |
| 3 |
# |
| 4 |
|
| 5 |
|
| 6 |
# Must have debug code to use SET SESSION debug |
| 7 |
--source include/have_debug.inc |
| 8 |
|
| 9 |
# Valgrind can hang or return spurious messages on DBUG_SUICIDE |
| 10 |
--source include/not_valgrind.inc |
| 11 |
|
| 12 |
|
| 13 |
######################################################################### |
| 14 |
# # |
| 15 |
# Will test following scenarios: # |
| 16 |
# 1. Effect of errors on temp-table # |
| 17 |
######################################################################### |
| 18 |
|
| 19 |
|
| 20 |
#------------------------------------------------------------- |
| 21 |
# |
| 22 |
# create test-bed. |
| 23 |
# |
| 24 |
let $per_table = `select @@innodb_file_per_table`; |
| 25 |
set global innodb_file_per_table = 0; |
| 26 |
|
| 27 |
#------------------------------------------------------------ |
| 28 |
# |
| 29 |
# 1. Effect of errors on temp-table |
| 30 |
# |
| 31 |
set global innodb_file_per_table = 1; |
| 32 |
call mtr.add_suppression("No space left on device"); |
| 33 |
call mtr.add_suppression("table.+ full"); |
| 34 |
call mtr.add_suppression("Cannot create file"); |
| 35 |
|
| 36 |
# In the test scenario, there can be orphaned .frm files. |
| 37 |
# These are expected. So suppressing the associated warnings. |
| 38 |
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* table .* does not exist " |
| 39 |
"in the InnoDB internal"); |
| 40 |
|
| 41 |
# |
| 42 |
--exec echo "restart " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 43 |
set session debug="+d,ib_ddl_crash_during_tablespace_alloc"; |
| 44 |
--error 2013 |
| 45 |
create temporary table t1 |
| 46 |
(a int, b int, primary key(a), index(b)) engine = innodb; |
| 47 |
# |
| 48 |
--enable_reconnect |
| 49 |
--source include/wait_until_connected_again.inc |
| 50 |
--disable_reconnect |
| 51 |
create temporary table t1 |
| 52 |
(a int, b int, primary key(a), index(b)) engine = innodb; |
| 53 |
insert into t1 values (10, 11); |
| 54 |
select * from t1; |
| 55 |
drop table t1; |
| 56 |
# |
| 57 |
# |
| 58 |
set session debug="+d,ib_create_table_fail_at_create_index"; |
| 59 |
--error ER_INDEX_COLUMN_TOO_LONG |
| 60 |
create temporary table t1 |
| 61 |
(a int, b int, primary key(a), index(b)) engine = innodb; |
| 62 |
--error ER_NO_SUCH_TABLE |
| 63 |
insert into t1 values (10, 11); |
| 64 |
set session debug="-d,ib_create_table_fail_at_create_index"; |
| 65 |
create temporary table t1 |
| 66 |
(a int, b int, primary key(a), index(b)) engine = innodb; |
| 67 |
insert into t1 values (10, 11); |
| 68 |
drop table t1; |
| 69 |
|
| 70 |
|
| 71 |
#------------------------------------------------------------- |
| 72 |
# |
| 73 |
# Temp table with PK-FK -FK constraint is igonered for temp |
| 74 |
# tables |
| 75 |
|
| 76 |
--disable_warnings |
| 77 |
drop table if exists parent,child; |
| 78 |
--enable_warnings |
| 79 |
create temporary table parent ( i int primary key ) engine = innodb; |
| 80 |
create table child ( j int references parent(i)) engine = innodb; |
| 81 |
insert into parent values (1),(2),(3),(4); |
| 82 |
insert into child values (1),(2),(3),(4); |
| 83 |
# We can insert non referencing values as constraint is ignored for temp table |
| 84 |
insert into child values (5),(6); |
| 85 |
select * from parent; |
| 86 |
select * from child; |
| 87 |
# |
| 88 |
--source include/restart_mysqld.inc |
| 89 |
# |
| 90 |
# parent table will be removed on restart as its temp table |
| 91 |
--error ER_NO_SUCH_TABLE |
| 92 |
select * from parent ; |
| 93 |
select * from child ; |
| 94 |
drop table child; |