Debian Codegraph @

mysql-test/suite/innodb/t/tablespace_rename.test

raw
1 #
2 # This testcase is to check if tablespace rename is handled correctly
3 # during recovery. Assumption is file per table.
4 #
5 # Crash between each of the points listed below :
6 # - RENAME TABLE t to t1; -- gets translated into the following steps
7 #
8 # 1. WRITE_LOG "MLOG_FILE_RENAME t, t1";
9 #
10 # 2. RENAME FILE t.ibd TO t1.ibd;
11 #
12 # 3. COMPLETED
13 #
14 --source include/not_valgrind.inc
15
16 # the DBUG_EXECUTE_IF() macro needs a debug server.
17 --source include/have_debug.inc
18
19 --disable_query_log
20 # These values can change during the test
21 LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
22
23 # Set up some variables
24 LET $MYSQL_DATA_DIR = `select @@datadir`;
25 LET $DATA_DIRECTORY_CLAUSE = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
26 --enable_query_log
27
28 SET GLOBAL innodb_file_per_table=ON;
29
30 --echo #
31 --echo # Tablespace rename
32 --echo #
33
34 --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
35 CREATE TABLE t1 (c1 int KEY) ENGINE=Innodb;
36 INSERT INTO t1 VALUES (1);
37 SELECT * FROM t1;
38 SHOW TABLES;
39
40 --echo #
41 --echo # Test crash before writing MLOG_FILE_RENAME t2.
42 --echo # On recovery the rename never happened.
43 --echo #
44
45 --source include/expect_crash.inc
46
47 SET SESSION debug="+d,ib_crash_rename_log_1";
48
49 --error CR_SERVER_LOST
50 RENAME TABLE t1 TO t2;
51
52 --source include/start_mysqld.inc
53
54 SET SESSION debug="-d,ib_crash_rename_log_1";
55
56 SHOW TABLES;
57 INSERT INTO t1 VALUES (2);
58 SELECT * FROM t1;
59
60 --echo #
61 --echo # Cleanup
62 --echo #
63
64 DROP TABLE t1;
65
66 -- disable_query_log
67 eval set global innodb_file_per_table=$innodb_file_per_table_orig;
68 -- enable_query_log
69