polardbxengine/mysql-test/suite/innodb/t/tablespace_temp_table_debug...

200 lines
5.8 KiB
Plaintext

#
# WL#6560: InnoDB: Separate tablespace for innodb-temp-tables.
#
--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
--source include/have_innodb_max_16k.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");
################################################################################
#
# Will test following scenarios:
# 1. hit a crash point during tablespace creation to ensure temp-table
# is recovered correctly.
# 2. hit a crash point during table creation.
# 3. hit a crash point during tablespace expansion.
# 4. hit a crash point while appying log
#
################################################################################
#-----------------------------------------------------------------------------
#
# 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 --log-error-verbosity=3 > $SEARCH_FILE 2>&1;
let crash = $args --innodb-force-recovery-crash;
#-----------------------------------------------------------------------------
#
# 1. hit a crash point during tablespace creation to ensure temp-table
# is recovered correctly.
#
--echo "testing creation of tablepsace by enabling error path"
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*
#
--source include/shutdown_mysqld.inc
#
--echo "Temp-tablespace removed on shutdown"
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*
--echo --innodb-force-recovery-crash=100
--echo "Next stmt will crash server"
--error 137,3
--exec $MYSQLD_CMD $crash=100
let SEARCH_PATTERN = Creating shared tablespace for temporary tables;
--source include/search_pattern.inc
#
--source include/start_mysqld.inc
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine=innodb;
insert into t1 values (1, 'c', 'b');
select * from t1;
drop table t1;
#-----------------------------------------------------------------------------
#
# 2. hit a crash point during table creation.
#
--echo "try hitting crash-point during table creation"
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
set session debug="+d,ib_ddl_crash_during_create2";
--error 2013
create temporary table t1
(a int, b int, primary key(a), index(b)) engine = innodb;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--echo # files in MYSQL_DATA_DIR
--list_files $MYSQL_DATA_DIR/ ibtmp*
create temporary table t1
(a int, b int, primary key(a), index(b)) engine = innodb;
insert into t1 values (1, 2);
select * from t1;
drop table t1;
#-----------------------------------------------------------------------------
#
# 3. hit a crash point during tablespace expansion.
#
set session debug="-d,ib_ddl_crash_during_create";
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 <= 5000) DO
insert into t1 values (i, 'a', 'b');
insert into t2 values (i, 'a', 'b');
set i = i + 1;
end while;
end|
delimiter ;|
set autocommit = 0;
--disable_query_log
call populate_t1_t2();
--echo # set debug point ib_crash_during_tablespace_extension
--enable_query_log
set session debug="+d,ib_crash_during_tablespace_extension";
select count(*) from t1;
select count(*) from t2;
commit;
show tables;
select count(*) from t1;
select count(*) from t2;
--echo # stnt will result in tablespace extension
--exec echo "restart " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
call populate_t1_t2();
#
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--source include/wait_until_connected_again.inc
--disable_reconnect
#
use test;
show tables;
select count(*) from t2;
select * from t2 limit 10;
set autocommit = 1;
truncate table t2;
select count(*) from t2;
#
drop procedure populate_t1_t2;
drop table t2;
#-----------------------------------------------------------------------------
#
# 4. hit a crash point while appying log
#
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;
insert into t1 values (1, 'a', 'b');
insert into t2 values (1, 'a', 'b');
select * from t1;
select * from t2;
set session debug="+d,crash_commit_after";
--exec echo "restart " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
insert into t2 values (2, 'a', 'b');
#
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--source include/wait_until_connected_again.inc
--disable_reconnect
use test;
show tables;
select * from t2;
insert into t2 values (3, 'a', 'b');
select * from t2;
#
create temporary table t1
(a int, b char(100), c char(100)) engine = innodb;
insert into t1 values (1, 'a', 'b');
begin;
insert into t2 values (4, 'a', 'b');
--source include/kill_and_restart_mysqld.inc
show tables;
select * from t2;
update t2 set a = a * -1;
select * from t2 order by a;
#
create temporary table t1
(a int, b char(100), c char(100)) engine = innodb;
insert into t1 values (1, 'a', 'b');
begin;
insert into t1 values (4, 'a', 'b');
# crash on temp table commit_before
--source include/kill_and_restart_mysqld.inc
show tables;
SELECT * from t2;
update t2 set a = a * -1;
SELECT * from t2 order by a;
#
drop table t2;