| 1 |
# |
| 2 |
# WL#6560: InnoDB: Separate tablespace for innodb-temp-tables. |
| 3 |
# |
| 4 |
|
| 5 |
--source include/have_debug.inc |
| 6 |
|
| 7 |
# Valgrind can hang or return spurious messages on DBUG_SUICIDE |
| 8 |
--source include/not_valgrind.inc |
| 9 |
# Avoid CrashReporter popup on Mac |
| 10 |
--source include/not_crashrep.inc |
| 11 |
|
| 12 |
--source include/have_innodb_max_16k.inc |
| 13 |
|
| 14 |
# In the test scenario, there can be orphaned .frm files. |
| 15 |
# These are expected. So suppressing the associated warnings. |
| 16 |
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* table .* does not exist " |
| 17 |
"in the InnoDB internal"); |
| 18 |
|
| 19 |
################################################################################ |
| 20 |
# |
| 21 |
# Will test following scenarios: |
| 22 |
# 1. hit a crash point during tablespace creation to ensure temp-table |
| 23 |
# is recovered correctly. |
| 24 |
# 2. hit a crash point during table creation. |
| 25 |
# 3. hit a crash point during tablespace expansion. |
| 26 |
# 4. hit a crash point while appying log |
| 27 |
# |
| 28 |
################################################################################ |
| 29 |
|
| 30 |
#----------------------------------------------------------------------------- |
| 31 |
# |
| 32 |
# create test-bed |
| 33 |
# |
| 34 |
set global innodb_file_per_table = off; |
| 35 |
let $MYSQL_TMP_DIR = `select @@tmpdir`; |
| 36 |
let $MYSQL_DATA_DIR = `select @@datadir`; |
| 37 |
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/my_restart.err; |
| 38 |
let $args = --loose-console --log-error-verbosity=3 > $SEARCH_FILE 2>&1; |
| 39 |
let crash = $args --innodb-force-recovery-crash; |
| 40 |
|
| 41 |
#----------------------------------------------------------------------------- |
| 42 |
# |
| 43 |
# 1. hit a crash point during tablespace creation to ensure temp-table |
| 44 |
# is recovered correctly. |
| 45 |
# |
| 46 |
--echo "testing creation of tablepsace by enabling error path" |
| 47 |
--echo # files in MYSQL_DATA_DIR |
| 48 |
--list_files $MYSQL_DATA_DIR/ ibtmp* |
| 49 |
# |
| 50 |
--source include/shutdown_mysqld.inc |
| 51 |
# |
| 52 |
--echo "Temp-tablespace removed on shutdown" |
| 53 |
--echo # files in MYSQL_DATA_DIR |
| 54 |
--list_files $MYSQL_DATA_DIR/ ibtmp* |
| 55 |
--echo --innodb-force-recovery-crash=100 |
| 56 |
--echo "Next stmt will crash server" |
| 57 |
--error 137,3 |
| 58 |
--exec $MYSQLD_CMD $crash=100 |
| 59 |
let SEARCH_PATTERN = Creating shared tablespace for temporary tables; |
| 60 |
--source include/search_pattern.inc |
| 61 |
# |
| 62 |
--source include/start_mysqld.inc |
| 63 |
--echo # files in MYSQL_DATA_DIR |
| 64 |
--list_files $MYSQL_DATA_DIR/ ibtmp* |
| 65 |
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine=innodb; |
| 66 |
insert into t1 values (1, 'c', 'b'); |
| 67 |
select * from t1; |
| 68 |
drop table t1; |
| 69 |
|
| 70 |
#----------------------------------------------------------------------------- |
| 71 |
# |
| 72 |
# 2. hit a crash point during table creation. |
| 73 |
# |
| 74 |
--echo "try hitting crash-point during table creation" |
| 75 |
--echo # files in MYSQL_DATA_DIR |
| 76 |
--list_files $MYSQL_DATA_DIR/ ibtmp* |
| 77 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 78 |
set session debug="+d,ib_ddl_crash_during_create2"; |
| 79 |
--error 2013 |
| 80 |
create temporary table t1 |
| 81 |
(a int, b int, primary key(a), index(b)) engine = innodb; |
| 82 |
--enable_reconnect |
| 83 |
--source include/wait_until_connected_again.inc |
| 84 |
--disable_reconnect |
| 85 |
--echo # files in MYSQL_DATA_DIR |
| 86 |
--list_files $MYSQL_DATA_DIR/ ibtmp* |
| 87 |
create temporary table t1 |
| 88 |
(a int, b int, primary key(a), index(b)) engine = innodb; |
| 89 |
insert into t1 values (1, 2); |
| 90 |
select * from t1; |
| 91 |
drop table t1; |
| 92 |
|
| 93 |
#----------------------------------------------------------------------------- |
| 94 |
# |
| 95 |
# 3. hit a crash point during tablespace expansion. |
| 96 |
# |
| 97 |
set session debug="-d,ib_ddl_crash_during_create"; |
| 98 |
use test; |
| 99 |
create temporary table t1 |
| 100 |
(a int, b char(100), c char(100)) engine = innodb; |
| 101 |
create table t2 |
| 102 |
(a int, b char(100), c char(100)) engine = innodb; |
| 103 |
delimiter |; |
| 104 |
create procedure populate_t1_t2() |
| 105 |
begin |
| 106 |
declare i int default 1; |
| 107 |
while (i <= 5000) DO |
| 108 |
insert into t1 values (i, 'a', 'b'); |
| 109 |
insert into t2 values (i, 'a', 'b'); |
| 110 |
set i = i + 1; |
| 111 |
end while; |
| 112 |
end| |
| 113 |
delimiter ;| |
| 114 |
set autocommit = 0; |
| 115 |
--disable_query_log |
| 116 |
call populate_t1_t2(); |
| 117 |
--echo # set debug point ib_crash_during_tablespace_extension |
| 118 |
--enable_query_log |
| 119 |
set session debug="+d,ib_crash_during_tablespace_extension"; |
| 120 |
select count(*) from t1; |
| 121 |
select count(*) from t2; |
| 122 |
commit; |
| 123 |
show tables; |
| 124 |
select count(*) from t1; |
| 125 |
select count(*) from t2; |
| 126 |
--echo # stnt will result in tablespace extension |
| 127 |
--exec echo "restart " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 128 |
--error 2013 |
| 129 |
call populate_t1_t2(); |
| 130 |
# |
| 131 |
--enable_reconnect |
| 132 |
# Write file to make mysql-test-run.pl start up the server again |
| 133 |
--source include/wait_until_connected_again.inc |
| 134 |
--disable_reconnect |
| 135 |
# |
| 136 |
use test; |
| 137 |
show tables; |
| 138 |
select count(*) from t2; |
| 139 |
select * from t2 limit 10; |
| 140 |
set autocommit = 1; |
| 141 |
truncate table t2; |
| 142 |
select count(*) from t2; |
| 143 |
# |
| 144 |
drop procedure populate_t1_t2; |
| 145 |
drop table t2; |
| 146 |
|
| 147 |
|
| 148 |
#----------------------------------------------------------------------------- |
| 149 |
# |
| 150 |
# 4. hit a crash point while appying log |
| 151 |
# |
| 152 |
use test; |
| 153 |
create temporary table t1 |
| 154 |
(a int, b char(100), c char(100)) engine = innodb; |
| 155 |
create table t2 |
| 156 |
(a int, b char(100), c char(100)) engine = innodb; |
| 157 |
insert into t1 values (1, 'a', 'b'); |
| 158 |
insert into t2 values (1, 'a', 'b'); |
| 159 |
select * from t1; |
| 160 |
select * from t2; |
| 161 |
set session debug="+d,crash_commit_after"; |
| 162 |
--exec echo "restart " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 163 |
--error 2013 |
| 164 |
insert into t2 values (2, 'a', 'b'); |
| 165 |
# |
| 166 |
--enable_reconnect |
| 167 |
# Write file to make mysql-test-run.pl start up the server again |
| 168 |
--source include/wait_until_connected_again.inc |
| 169 |
--disable_reconnect |
| 170 |
use test; |
| 171 |
show tables; |
| 172 |
select * from t2; |
| 173 |
insert into t2 values (3, 'a', 'b'); |
| 174 |
select * from t2; |
| 175 |
# |
| 176 |
create temporary table t1 |
| 177 |
(a int, b char(100), c char(100)) engine = innodb; |
| 178 |
insert into t1 values (1, 'a', 'b'); |
| 179 |
begin; |
| 180 |
insert into t2 values (4, 'a', 'b'); |
| 181 |
--source include/kill_and_restart_mysqld.inc |
| 182 |
show tables; |
| 183 |
select * from t2; |
| 184 |
update t2 set a = a * -1; |
| 185 |
select * from t2 order by a; |
| 186 |
# |
| 187 |
create temporary table t1 |
| 188 |
(a int, b char(100), c char(100)) engine = innodb; |
| 189 |
insert into t1 values (1, 'a', 'b'); |
| 190 |
begin; |
| 191 |
insert into t1 values (4, 'a', 'b'); |
| 192 |
# crash on temp table commit_before |
| 193 |
--source include/kill_and_restart_mysqld.inc |
| 194 |
show tables; |
| 195 |
SELECT * from t2; |
| 196 |
update t2 set a = a * -1; |
| 197 |
SELECT * from t2 order by a; |
| 198 |
# |
| 199 |
drop table t2; |