mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MDEV-11816 Disallow CREATE TEMPORARY TABLE…ROW_FORMAT=COMPRESSED
MySQL 5.7 allows temporary tables to be created in ROW_FORMAT=COMPRESSED. The usefulness of this is questionable. WL#7899 in MySQL 8.0.0 prevents the creation of such compressed tables, so that all InnoDB temporary tables will be located inside the predefined InnoDB temporary tablespace. Pick up and adjust some tests from MySQL 5.7 and 8.0. dict_tf_to_fsp_flags(): Remove the parameter is_temp. fsp_flags_init(): Remove the parameter is_temporary. row_mysql_drop_temp_tables(): Remove. There cannot be any temporary tables in InnoDB. (This never removed #sql* tables in the datadir which were created by DDL.) dict_table_t::dir_path_of_temp_table: Remove. create_table_info_t::m_temp_path: Remove. create_table_info_t::create_options_are_invalid(): Do not allow ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE for temporary tables. create_table_info_t::innobase_table_flags(): Do not unnecessarily prevent CREATE TEMPORARY TABLE with SPATIAL INDEX. (MySQL 5.7 does allow this.) fil_space_belongs_in_lru(): The only FIL_TYPE_TEMPORARY tablespace is never subjected to closing least-recently-used files.
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
wl6560 : Very long, timeout
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
--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 #
|
||||
# Sceanrio covered: #
|
||||
# 1. bulk-insert with rollback + commit: this will ensure btree #
|
||||
# node split with rollback and commit. #
|
||||
####################################################################
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
#
|
||||
# 1. bulk-insert with rollback + commit: this will ensure btree #
|
||||
# node split with rollback and commit. #
|
||||
#
|
||||
create temporary table t1
|
||||
(keyc int, c1 char(100), c2 char(100),
|
||||
primary key(keyc), index sec_index(c1)
|
||||
) engine = innodb;
|
||||
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;
|
||||
#
|
||||
--disable_warnings
|
||||
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;
|
||||
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;
|
||||
--enable_warnings
|
||||
--source suite/innodb_zip/include/innodb_dml_ops.inc
|
||||
drop table t1;
|
||||
drop table 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)
|
||||
) engine = innodb;
|
||||
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;
|
||||
#
|
||||
|
||||
@@ -1,468 +0,0 @@
|
||||
--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 #
|
||||
# - Table with primary,composite,prefix,secondary index #
|
||||
# - Insert/delete/update with transactioons #
|
||||
# - Transaction with commit,rollback,savepoint statements #
|
||||
# - 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 #
|
||||
# - 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
|
||||
# 1. Create temp table with row types , index , sufficent data types
|
||||
# 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,
|
||||
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=redundant;
|
||||
|
||||
create temporary table t2(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=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,
|
||||
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=dynamic;
|
||||
|
||||
create temporary table t5(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;
|
||||
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
|
||||
now(),(100.55+n));
|
||||
insert into t5 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));
|
||||
|
||||
if (n > 10) then
|
||||
commit;
|
||||
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;
|
||||
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
|
||||
now(),(100.55+n+inner_loop));
|
||||
insert into t5 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));
|
||||
|
||||
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;
|
||||
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
|
||||
now(),(100.55+n+inner_loop));
|
||||
insert into t5 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));
|
||||
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),
|
||||
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),
|
||||
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),
|
||||
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
|
||||
now(),(100.55+n+inner_loop));
|
||||
insert into t5 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));
|
||||
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();
|
||||
-- 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
|
||||
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
|
||||
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;
|
||||
# Check duplicate key constraint + insert ignore
|
||||
--error ER_DUP_ENTRY
|
||||
insert into t1 values (20,1,'a','a','a','a','a',now(),100.55);
|
||||
insert ignore into t1 values (20,1,'a','a','a','a','a',now(),100.55);
|
||||
--error ER_DUP_ENTRY
|
||||
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
|
||||
insert into t5 values (20,1,'a','a','a','a','a',now(),100.55);
|
||||
insert ignore into t5 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 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 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
|
||||
insert into t5 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 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 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 <file> from t1 ;
|
||||
--disable_query_log
|
||||
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 <file> into temp_1 ;
|
||||
--disable_query_log
|
||||
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1.outfile' into table temp_1;
|
||||
--enable_query_log
|
||||
select count(*) from temp_1;
|
||||
|
||||
# Alter table to add column and primary key
|
||||
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)
|
||||
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,
|
||||
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),
|
||||
index (c3,c4(50),c5(50)),
|
||||
index (c2))
|
||||
engine=innodb;
|
||||
PREPARE stm FROM "insert into prep_1 values(?,?,repeat(concat(' tc3_',?),30),repeat(concat(' tc4_',?),800),repeat(concat(' tc_',?),800),repeat(concat(' tc6_',?),245),repeat(concat(' tc7_',?),245),now(),(100.55+?))";
|
||||
set @var = 5;
|
||||
set @var_static = 5;
|
||||
while ($prep_loop>0)
|
||||
{
|
||||
eval EXECUTE stm USING @var,@var,@var,@var,@var,@var,@var,@var;
|
||||
eval EXECUTE stm USING @var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static,@var_static;
|
||||
dec $prep_loop;
|
||||
set @var = @var - 1;
|
||||
}
|
||||
select c1,left(c3,15) from prep_1 order by c1 ;
|
||||
select count(*) from prep_1;
|
||||
|
||||
PREPARE stm_1 FROM "UPDATE prep_1 SET c1 = c1 + 1";
|
||||
EXECUTE stm_1;
|
||||
EXECUTE stm_1;
|
||||
select c1,left(c3,15) from prep_1 order by c1 ;
|
||||
select count(*) from prep_1;
|
||||
|
||||
PREPARE stm_2 FROM "DELETE FROM prep_1 ORDER BY c1 LIMIT 1";
|
||||
EXECUTE stm_2;
|
||||
EXECUTE stm_2;
|
||||
select c1,left(c3,15) from prep_1 order by c1 ;
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
#
|
||||
--source suite/innodb_zip/include/innodb_temp_table_dml.inc
|
||||
#
|
||||
# alter table
|
||||
--error ER_CANNOT_DISCARD_TEMPORARY_TABLE
|
||||
alter table t1 discard tablespace;
|
||||
#
|
||||
# drop table
|
||||
drop table t1;
|
||||
set global innodb_file_per_table = off;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 4. Test bulk-loading that result in auto-extension of temp-tablespace.
|
||||
#
|
||||
create temporary table t1
|
||||
(keyc int, c1 char(100), c2 char(100),
|
||||
primary key(keyc)) engine = innodb;
|
||||
delimiter |;
|
||||
CREATE PROCEDURE populate_t1()
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 1;
|
||||
while (i <= 20000) DO
|
||||
insert into t1 values (i, 'a', 'b');
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
END|
|
||||
delimiter ;|
|
||||
set autocommit=0;
|
||||
select count(*) from t1;
|
||||
call populate_t1();
|
||||
select count(*) from t1;
|
||||
select * from t1 limit 10;
|
||||
set autocommit=1;
|
||||
truncate table t1;
|
||||
select count(*) from t1;
|
||||
#
|
||||
drop procedure populate_t1;
|
||||
drop table t1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 5. re-creation of temp-tablespace on re-start.
|
||||
# also to ensure non-existence of existing temp-table.
|
||||
#
|
||||
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
|
||||
insert into t1 values (1, 'c', 'b');
|
||||
select * from t1;
|
||||
#
|
||||
--source include/restart_mysqld.inc
|
||||
#
|
||||
--echo # files in MYSQL_DATA_DIR
|
||||
--list_files $MYSQL_DATA_DIR/ ibtmp*
|
||||
use test;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
select * from t1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 6. restart server in innodb-read-only mode. this will also
|
||||
# block creation of temp-tables.
|
||||
#
|
||||
#
|
||||
--echo "testing temp-table creation in --innodb_read_only mode"
|
||||
let $restart_parameters=--innodb-read-only;
|
||||
--source include/restart_mysqld.inc
|
||||
#
|
||||
use test;
|
||||
show tables;
|
||||
--error ER_INNODB_READ_ONLY, 1005
|
||||
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 7. try starting server with shared and temp-tablespace filename same.
|
||||
#
|
||||
--source include/shutdown_mysqld.inc
|
||||
--echo "testing system and temp tablespace name conflict"
|
||||
--error 1
|
||||
--exec $MYSQLD_CMD $nameconflicts
|
||||
let SEARCH_PATTERN = innodb_temporary and innodb_system file names seem to be the same;
|
||||
--source ./include/search_pattern_in_file.inc
|
||||
--remove_file $SEARCH_FILE
|
||||
--echo "restarting server in normal mode"
|
||||
--enable_reconnect
|
||||
let $restart_parameters = restart;
|
||||
--source include/start_mysqld.inc
|
||||
#
|
||||
show tables;
|
||||
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
|
||||
drop table t1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 8. try re-starting server with param so that temp-tablespace can't be expanded
|
||||
# and insert enough data to make it full.
|
||||
#
|
||||
--echo # test condition of full-temp-tablespace
|
||||
let $restart_parameters=--innodb_temp_data_file_path=ibtmp1:12M;
|
||||
--source include/restart_mysqld.inc
|
||||
#
|
||||
create temporary table t1
|
||||
(keyc int, c1 char(100), c2 char(100),
|
||||
primary key(keyc)) engine = innodb;
|
||||
delimiter |;
|
||||
CREATE PROCEDURE populate_t1()
|
||||
BEGIN
|
||||
DECLARE i INT DEFAULT 1;
|
||||
while (i <= 20000) DO
|
||||
insert into t1 values (i, 'a', 'b');
|
||||
SET i = i + 1;
|
||||
END WHILE;
|
||||
END|
|
||||
delimiter ;|
|
||||
set autocommit=0;
|
||||
select count(*) from t1;
|
||||
--error ER_RECORD_FILE_FULL
|
||||
call populate_t1();
|
||||
#
|
||||
drop procedure populate_t1;
|
||||
drop table t1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 9. tests for different row format types and key block sizes for
|
||||
# compressed tables.
|
||||
#
|
||||
set innodb_strict_mode = off;
|
||||
--disable_warnings
|
||||
set global innodb_file_per_table = 0;
|
||||
set global innodb_file_format = 'Antelope';
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = compressed;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
drop table t;
|
||||
#
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = compressed key_block_size = 8;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
#
|
||||
drop table t;
|
||||
set global innodb_file_per_table = 1;
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = compressed key_block_size = 8;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
drop table t;
|
||||
#
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = dynamic;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
drop table t;
|
||||
#
|
||||
set innodb_strict_mode = on;
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = dynamic;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
drop table t;
|
||||
#
|
||||
set global innodb_file_format = 'Barracuda';
|
||||
set innodb_strict_mode = off;
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = compressed key_block_size = 8;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
# explicitly disabling it else it will generate warning of ignoring
|
||||
# key_block_size when suite is run with innodb-page-size=4k
|
||||
#show warnings;
|
||||
set innodb_strict_mode = default;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
#
|
||||
drop table t;
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = compressed;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
drop table t;
|
||||
#
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = dynamic;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
drop table t;
|
||||
#
|
||||
set innodb_strict_mode = on;
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = dynamic;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
drop table t;
|
||||
set innodb_strict_mode = off;
|
||||
#
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = dynamic key_block_size = 4;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
drop table t;
|
||||
#
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb row_format = compact;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
drop table t;
|
||||
#
|
||||
create temporary table t (
|
||||
i int)
|
||||
engine = innodb key_block_size = 4;
|
||||
--replace_regex /[0-9]+/NUMBER/
|
||||
show warnings;
|
||||
--echo #files in MYSQL_TMP_DIR
|
||||
--replace_regex /#sql[0-9a-f_]*/#sql<temporary>/
|
||||
--list_files $MYSQL_TMP_DIR/ *.ibd
|
||||
drop table t;
|
||||
#
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 10. try restarting server with raw device specified for temp-tablespace.
|
||||
#
|
||||
--source include/shutdown_mysqld.inc
|
||||
--echo "testing temp tablespace non-support for raw device"
|
||||
--error 1
|
||||
--exec $MYSQLD_CMD $rawdevice1
|
||||
let SEARCH_PATTERN = support raw device;
|
||||
--source include/search_pattern_in_file.inc
|
||||
--remove_file $SEARCH_FILE
|
||||
--echo "testing temp tablespace non-support for raw device"
|
||||
--error 1
|
||||
--exec $MYSQLD_CMD $rawdevice2
|
||||
let SEARCH_PATTERN = support raw device;
|
||||
--source include/search_pattern_in_file.inc
|
||||
--remove_file $SEARCH_FILE
|
||||
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
show tables;
|
||||
create temporary table t1 (
|
||||
keyc int, c1 char(100), c2 char(100)
|
||||
) engine = innodb;
|
||||
drop table t1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 11. try restarting server with temp-tablespace less than min. threshold
|
||||
#
|
||||
--source include/shutdown_mysqld.inc
|
||||
--echo "try starting server with temp-tablespace size < min. threshold"
|
||||
--error 1
|
||||
--exec $MYSQLD_CMD $sizeoftempfile1
|
||||
let SEARCH_PATTERN = Tablespace size must be at least;
|
||||
--source ./include/search_pattern_in_file.inc
|
||||
--remove_file $SEARCH_FILE
|
||||
--echo "try starting server with sys-tablespace size < min. threshold"
|
||||
--error 1
|
||||
--exec $MYSQLD_CMD $sizeoftempfile2
|
||||
let SEARCH_PATTERN = Tablespace size must be at least;
|
||||
--source ./include/search_pattern_in_file.inc
|
||||
--remove_file $SEARCH_FILE
|
||||
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
show tables;
|
||||
create temporary table t1 (
|
||||
keyc int, c1 char(100), c2 char(100)
|
||||
) engine = innodb;
|
||||
drop table t1;
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
# 12. no file specified for temp-tablespace.
|
||||
#
|
||||
--source include/shutdown_mysqld.inc
|
||||
|
||||
--echo "try starting server with no file specified for temp-tablespace"
|
||||
--error 1
|
||||
--exec $MYSQLD_CMD $notemptablespacefile
|
||||
let SEARCH_PATTERN = init function returned error;
|
||||
--source ./include/search_pattern_in_file.inc
|
||||
--remove_file $SEARCH_FILE
|
||||
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
show tables;
|
||||
create temporary table t1 (
|
||||
keyc int, c1 char(100), c2 char(100)
|
||||
) engine = innodb;
|
||||
drop table t1;
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user