Skip to content

Commit adbab0d

Browse files
committed
MDEV-13625: Add the test innodb.innodb-wl5980-debug
1 parent 10ebdb7 commit adbab0d

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
2+
call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
3+
#
4+
# WL5980 Remote tablespace debug error injection tests.
5+
#
6+
CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir' ;
7+
INSERT INTO t1 VALUES (1, 'tablespace');
8+
SELECT * FROM t1;
9+
a b
10+
1 tablespace
11+
#
12+
# Test the second injection point in fil_rename_tablespace().
13+
# Make sure the table is useable after this failure.
14+
#
15+
SET @save_dbug=@@debug_dbug;
16+
SET debug_dbug="+d,fil_rename_tablespace_failure_2";
17+
RENAME TABLE t1 TO t2;
18+
SET debug_dbug=@save_dbug;
19+
INSERT INTO t1 VALUES (2, 'tablespace');
20+
SELECT * FROM t1;
21+
a b
22+
1 tablespace
23+
2 tablespace
24+
#
25+
# Cleanup
26+
#
27+
DROP TABLE t1;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#
2+
# This testcase is to check the various debug injection points
3+
# to make sure error conditions react corectly and acheive
4+
# better code coverage.
5+
#
6+
7+
# Not supported in embedded
8+
--source include/not_embedded.inc
9+
--source include/have_debug.inc
10+
--source include/have_innodb.inc
11+
12+
# These messages are expected in the log
13+
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
14+
call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
15+
16+
# Set up some variables
17+
LET $MYSQL_DATA_DIR = `select @@datadir`;
18+
LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
19+
--enable_query_log
20+
21+
--echo #
22+
--echo # WL5980 Remote tablespace debug error injection tests.
23+
--echo #
24+
25+
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
26+
eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ;
27+
INSERT INTO t1 VALUES (1, 'tablespace');
28+
SELECT * FROM t1;
29+
30+
--echo #
31+
--echo # Test the second injection point in fil_rename_tablespace().
32+
--echo # Make sure the table is useable after this failure.
33+
--echo #
34+
SET @save_dbug=@@debug_dbug;
35+
SET debug_dbug="+d,fil_rename_tablespace_failure_2";
36+
--disable_result_log
37+
--error ER_ERROR_ON_RENAME
38+
RENAME TABLE t1 TO t2;
39+
--enable_result_log
40+
SET debug_dbug=@save_dbug;
41+
INSERT INTO t1 VALUES (2, 'tablespace');
42+
SELECT * FROM t1;
43+
44+
--echo #
45+
--echo # Cleanup
46+
--echo #
47+
48+
DROP TABLE t1;
49+
50+
--rmdir $MYSQL_TMP_DIR/alt_dir/test
51+
--rmdir $MYSQL_TMP_DIR/alt_dir

storage/innobase/fil/fil0fil.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,8 +3216,13 @@ fil_rename_tablespace(
32163216
space, node, new_name, new_path);
32173217

32183218
if (success) {
3219+
DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
3220+
goto skip_second_rename; );
32193221
success = os_file_rename(
32203222
innodb_file_data_key, old_path, new_path);
3223+
DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
3224+
skip_second_rename:
3225+
success = FALSE; );
32213226

32223227
if (!success) {
32233228
/* We have to revert the changes we made

storage/xtradb/fil/fil0fil.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,8 +3262,13 @@ fil_rename_tablespace(
32623262
space, node, new_name, new_path);
32633263

32643264
if (success) {
3265+
DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
3266+
goto skip_second_rename; );
32653267
success = os_file_rename(
32663268
innodb_file_data_key, old_path, new_path);
3269+
DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
3270+
skip_second_rename:
3271+
success = FALSE; );
32673272

32683273
if (!success) {
32693274
/* We have to revert the changes we made

0 commit comments

Comments
 (0)