162 lines
4.0 KiB
Plaintext
162 lines
4.0 KiB
Plaintext
#
|
|
# WL#6915: InnoDB: Undo logs for temp-tables (and related objects) should
|
|
# reside in temp-tablespace
|
|
#
|
|
--source include/no_valgrind_without_big.inc
|
|
|
|
################################################################################
|
|
#
|
|
# Will test following scenarios:
|
|
# 1. Try loading table with commit and rollback action
|
|
# (this will ensure proper rseg is being used).
|
|
# 2. Load temp and non-temp table with purge activity.
|
|
# 3. In xa trx try loading temp + non-temp table.
|
|
# (Same as case-2 but from xa perspective)
|
|
#
|
|
################################################################################
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# create test-bed
|
|
#
|
|
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 > $SEARCH_FILE 2>&1;
|
|
let crash = $args --innodb-force-recovery-crash;
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# 1. Try loading table with commit and rollback action.
|
|
# (this will ensure proper rseg is being used).
|
|
#
|
|
use test;
|
|
create temporary table t1
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
--source suite/innodb/include/innodb_rollback_segments_action.inc
|
|
drop table t1;
|
|
#
|
|
create table t1
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
--source suite/innodb/include/innodb_rollback_segments_action.inc
|
|
drop table t1;
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# 2. Load temp and non-temp table with purge activity.
|
|
#
|
|
use test;
|
|
create temporary table t1
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
create table t2
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
delimiter |;
|
|
create procedure populate_t1_t2()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 2000) DO
|
|
insert into t1 values (i, 'a', 'b');
|
|
insert into t2 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
create procedure populate_t1_t2_small()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 200) DO
|
|
insert into t1 values (i, 'a', 'b');
|
|
insert into t2 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
delimiter ;|
|
|
begin;
|
|
call populate_t1_t2();
|
|
commit;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
#
|
|
begin;
|
|
delete from t1 where a <= 100;
|
|
delete from t2 where a > 1900;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
commit;
|
|
#
|
|
begin;
|
|
update t1 set b = 'innodb' where b = 'a' and a <= 1000;
|
|
update t2 set b = 'myisam' where c = 'b' and a > 1000;
|
|
commit;
|
|
#
|
|
delete from t1 where b = 'a';
|
|
delete from t2 where c = 'myisam';
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
#
|
|
insert into t1 values (1000000, 'mysql', 'db');
|
|
begin;
|
|
call populate_t1_t2_small();
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
rollback;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
#
|
|
drop table t2;
|
|
drop table t1;
|
|
drop procedure populate_t1_t2;
|
|
drop procedure populate_t1_t2_small;
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# 3. In xa trx try loading temp + non-temp table.
|
|
# (Same as case-2 but from xa perspective)
|
|
#
|
|
create temporary table t1 (i int) engine=innodb;
|
|
create table t2 (i int) engine=innodb;
|
|
insert into t1 values (1);
|
|
insert into t2 values (101);
|
|
select * from t1;
|
|
select * from t2;
|
|
#
|
|
xa start 'tx1';
|
|
insert into t1 values (2), (3);
|
|
insert into t2 values (202), (303);
|
|
select * from t1;
|
|
select * from t2;
|
|
xa end 'tx1';
|
|
xa prepare 'tx1';
|
|
xa commit 'tx1';
|
|
select * from t1;
|
|
select * from t2;
|
|
#
|
|
xa start 'tx1';
|
|
insert into t1 values (2), (3);
|
|
insert into t2 values (202), (303);
|
|
select * from t1;
|
|
select * from t2;
|
|
xa end 'tx1';
|
|
xa prepare 'tx1';
|
|
xa rollback 'tx1';
|
|
select * from t1;
|
|
select * from t2;
|
|
#
|
|
#
|
|
xa start 'tx1';
|
|
insert into t1 values (2), (3);
|
|
select * from t1;
|
|
xa end 'tx1';
|
|
xa prepare 'tx1';
|
|
xa commit 'tx1';
|
|
select * from t1;
|
|
#
|
|
drop table t1;
|
|
drop table t2;
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# remove test-bed
|
|
#
|
|
set global innodb_file_per_table=default;
|