1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
#
# 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;
|