diff --git a/mysql-test/t/bugfix_discard_tablespace_with_unclear_error.test b/mysql-test/t/bugfix_discard_tablespace_with_unclear_error.test new file mode 100644 index 00000000000..3a07613311d --- /dev/null +++ b/mysql-test/t/bugfix_discard_tablespace_with_unclear_error.test @@ -0,0 +1,54 @@ +############################################################################### +# [bugfix] discard tablespace with unclear error +# +# After we discard the tablespace of a table without import it, +# selecting the data of it will write 'error 155' to master-error.log, +# which is unclearly. +# The bug is from: https://bugs.mysql.com/bug.php?id=86257 +############################################################################### +--source include/have_innodb.inc + +--echo # +--echo # prepare for test +--echo # +CREATE TABLE t1(c1 YEAR KEY,c2 INT,c3 BINARY); + +--echo # +--echo # there is no 'error 155' in master-error.log +--echo # +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err +--let $assert_only_after = CURRENT_TEST: rds.bugfix_discard_tablespace_with_unclear_error +--let $assert_count = 0 +--let $assert_select = .*Got error 155.* +--let $assert_text = Got error 155 when reading table +--source include/assert_grep.inc + +--echo # +--echo # discard the tablespace and select the data in table +--echo # +ALTER TABLE t1 DISCARD TABLESPACE; + +--error ER_TABLESPACE_DISCARDED +SELECT hex(c1),hex(c2) FROM t1 ORDER BY c1 DESC; + +--echo # +--echo # there is no 'error 155' in master-error.log, too +--echo # +--let $assert_select = .*Got error 155.* +--let $assert_text = Got error 155 when reading table +--source include/assert_grep.inc + +--echo # +--echo # we have a more clear error message in master-error.log +--echo # +--let $assert_count = 1 +--let $assert_select = .*The table 't1' doesn't have a corresponding tablespace.* +--let $assert_text = 't2' have no tablespace +--source include/assert_grep.inc + +CALL mtr.add_suppression("\\[Error\\].*The table 't1' doesn't have a corresponding tablespace.*"); + +--echo # +--echo # end of the test +--echo # +DROP TABLE t1;