206 lines
5.7 KiB
Plaintext
206 lines
5.7 KiB
Plaintext
#
|
|
# WL#6915: InnoDB: Undo logs for temp-tables (and related objects) should
|
|
# reside in temp-tablespace
|
|
#
|
|
--source include/have_debug.inc
|
|
|
|
# Valgrind can hang or return spurious messages on DBUG_SUICIDE
|
|
--source include/not_valgrind.inc
|
|
# Avoid CrashReporter popup on Mac
|
|
--source include/not_crashrep.inc
|
|
|
|
# In the test scenario, there can be orphaned .frm files.
|
|
# These are expected. So suppressing the associated warnings.
|
|
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* table .* does not exist "
|
|
"in the InnoDB internal");
|
|
call mtr.add_suppression("Found .* prepared XA transactions");
|
|
|
|
call mtr.add_suppression("innodb-rollback-segments");
|
|
|
|
################################################################################
|
|
#
|
|
# Will test following scenarios:
|
|
# 1. Hitting crash while preparing xa trx.
|
|
# 2. Hitting crash while committing normal trx involving temp/non-temp tables.
|
|
# 3. try to start server with different values of innodb_rollback_segments.
|
|
# (try scenario such that a rollback segment is shared by multiple trxs).
|
|
#
|
|
################################################################################
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# 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. Hitting crash while preparing xa trx.
|
|
#
|
|
create temporary table t1 (i int) engine=innodb;
|
|
create table t2 (i int) engine=innodb;
|
|
#
|
|
insert into t2 values (301);
|
|
xa start 'tx2';
|
|
insert into t1 values (2), (3);
|
|
insert into t2 values (202), (303);
|
|
select * from t1;
|
|
select * from t2;
|
|
xa end 'tx2';
|
|
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
set session debug="+d,ib_trx_crash_during_xa_prepare_step";
|
|
--error 2013
|
|
xa prepare 'tx2';
|
|
#
|
|
--enable_reconnect
|
|
--source include/wait_until_connected_again.inc
|
|
--disable_reconnect
|
|
#
|
|
select * from t2;
|
|
drop table t2;
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# 2. Hitting crash while committing normal trx involving temp/non-temp tables.
|
|
#
|
|
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 <= 50) DO
|
|
insert into t1 values (i, 'a', 'b');
|
|
insert into t2 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
delimiter ;|
|
|
call populate_t1_t2;
|
|
begin;
|
|
call populate_t1_t2();
|
|
update t1 set a = a + 1;
|
|
update t2 set a = a + 1;
|
|
select count(*) from t1;
|
|
select count(*) from t2;
|
|
--source include/expect_crash.inc
|
|
set session debug="+d,ib_trx_crash_during_commit";
|
|
# With bin-log enabled, COMMIT prepares the transaction before doing SE commit.
|
|
# So on restart, the prepared trx is recovered. Without bin-log, the trx would
|
|
# have been rolled back. Hence, crashing before commit.
|
|
--disable_query_log
|
|
if (`SELECT @@log_bin = 1`)
|
|
{
|
|
set session debug="+d,crash_commit_before";
|
|
}
|
|
--enable_query_log
|
|
--error 2013
|
|
commit;
|
|
#
|
|
--enable_reconnect
|
|
--source include/start_mysqld.inc
|
|
--source include/wait_until_connected_again.inc
|
|
--disable_reconnect
|
|
#
|
|
select count(*) from t2;
|
|
drop table t2;
|
|
drop procedure populate_t1_t2;
|
|
|
|
#-----------------------------------------------------------------------------
|
|
#
|
|
# 3. try to start server with different values of innodb_rollback_segments.
|
|
# (try scenario such that a rollback segment is shared by multiple trxs).
|
|
#
|
|
let $restart_parameters = restart: --innodb_rollback_segments=1;
|
|
--source include/restart_mysqld.inc
|
|
#
|
|
create table t (i int) engine=innodb;
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
create temporary table t2 (i int) engine=innodb;
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
drop table t;
|
|
drop table t2;
|
|
#
|
|
connect (con1,localhost,root,,);
|
|
connect (con2,localhost,root,,);
|
|
#
|
|
connection default;
|
|
delimiter |;
|
|
create procedure populate_t1_t2()
|
|
begin
|
|
declare i int default 1;
|
|
while (i <= 100) DO
|
|
insert into t1 values (i, 'a', 'b');
|
|
insert into t2 values (i, 'a', 'b');
|
|
set i = i + 1;
|
|
end while;
|
|
end|
|
|
delimiter ;|
|
|
create table t2
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
#
|
|
connection con1;
|
|
create temporary table t1
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
call populate_t1_t2();
|
|
select count(*) from t1;
|
|
drop table t1;
|
|
#
|
|
connection con2;
|
|
create temporary table t1
|
|
(a int, b char(100), c char(100)) engine = innodb;
|
|
call populate_t1_t2();
|
|
commit;
|
|
select count(*) from t1;
|
|
drop table t1;
|
|
#
|
|
connection default;
|
|
drop table t2;
|
|
drop procedure populate_t1_t2;
|
|
#
|
|
# trying with value innodb_rollback_segments = 1 (so only slot-0 redo rseg is active)
|
|
#
|
|
let $restart_parameters = restart: --innodb_rollback_segments=1;
|
|
--source include/restart_mysqld.inc
|
|
#
|
|
create table t (i int) engine=innodb;
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
create temporary table t2 (i int) engine=innodb;
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
drop table t;
|
|
drop table t2;
|
|
#
|
|
# trying with value innodb_rollback_segments = 8 (this will make 8 redo rseg active).
|
|
#
|
|
let $restart_parameters = restart: --innodb_rollback_segments=8;
|
|
--source include/restart_mysqld.inc
|
|
#
|
|
create table t (i int) engine=innodb;
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
create temporary table t2 (i int) engine=innodb;
|
|
insert into t values (1);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
insert into t values (2);
|
|
drop table t;
|
|
drop table t2;
|