diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-06-27 15:39:04 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-06-27 15:39:04 +0300 |
commit | 92feac53a649f39f81d10c8d0ea0353e7b3d8b92 (patch) | |
tree | a57c75315c8a32e47dec256f78bcf7cb3fb1cb30 | |
parent | 6d2b2365682d9b85d4df30f02e07301c3b11caba (diff) | |
download | mariadb-git-92feac53a649f39f81d10c8d0ea0353e7b3d8b92.tar.gz |
MDEV-19886 InnoDB returns misleading ER_NO_SUCH_TABLE_IN_ENGINE
A fix in MySQL 5.7.6 was not completely merged to MariaDB:
Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND"
-rw-r--r-- | mysql-test/suite/innodb/r/alter_missing_tablespace.result | 16 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/missing_tablespaces.result | 11 | ||||
-rw-r--r-- | mysql-test/suite/innodb/r/truncate_missing.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/alter_missing_tablespace.test | 13 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/missing_tablespaces.test | 36 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/truncate_missing.test | 4 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/missing_ibd.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/missing_ibd.test | 3 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 15 |
9 files changed, 74 insertions, 30 deletions
diff --git a/mysql-test/suite/innodb/r/alter_missing_tablespace.result b/mysql-test/suite/innodb/r/alter_missing_tablespace.result index 237d0df26ff..f9db353af3c 100644 --- a/mysql-test/suite/innodb/r/alter_missing_tablespace.result +++ b/mysql-test/suite/innodb/r/alter_missing_tablespace.result @@ -8,23 +8,23 @@ CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; CREATE TABLE t1(a SERIAL)ENGINE=InnoDB; INSERT INTO t1 VALUES(1),(2),(3); SELECT * FROM t; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB SHOW WARNINGS; Level Code Message Warning 1812 Tablespace is missing for table 'test/t' -Error 1932 Table 'test.t' doesn't exist in engine +Error 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB SHOW WARNINGS; Level Code Message Warning 1812 Tablespace is missing for table 'test/t' -Error 1932 Table 'test.t' doesn't exist in engine +Error 1030 Got error 194 "Tablespace is missing for a table" from storage engine InnoDB ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB ALTER TABLE t ALGORITHM=INPLACE, DISCARD TABLESPACE; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DISCARD TABLESPACE' at line 1 ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE; @@ -37,7 +37,7 @@ Warning 1812 Tablespace is missing for table 'test/t' Warning 1812 Tablespace is missing for table 'test/t' DROP TABLE t; SELECT * FROM `x..d`; -ERROR 42S02: Table 'test.x..d' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB DROP TABLE `x..d`; ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=INPLACE; diff --git a/mysql-test/suite/innodb/r/missing_tablespaces.result b/mysql-test/suite/innodb/r/missing_tablespaces.result new file mode 100644 index 00000000000..11b79273498 --- /dev/null +++ b/mysql-test/suite/innodb/r/missing_tablespaces.result @@ -0,0 +1,11 @@ +# +# Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND" +# +CREATE DATABASE `..................................................`; +USE `..................................................`; +CREATE TABLE `..................................................` (ID INT) +ENGINE=INNODB; +select * from `..................................................`; +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB +DROP TABLE `..................................................`; +DROP DATABASE `..................................................`; diff --git a/mysql-test/suite/innodb/r/truncate_missing.result b/mysql-test/suite/innodb/r/truncate_missing.result index 263880eccd2..423dc9eb537 100644 --- a/mysql-test/suite/innodb/r/truncate_missing.result +++ b/mysql-test/suite/innodb/r/truncate_missing.result @@ -11,7 +11,7 @@ t CREATE TABLE `t` ( UNIQUE KEY `a` (`a`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 SELECT * FROM t; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB TRUNCATE TABLE t; -ERROR 42S02: Table 'test.t' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test index 4ab291a69f8..0094db520ae 100644 --- a/mysql-test/suite/innodb/t/alter_missing_tablespace.test +++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test @@ -34,22 +34,21 @@ INSERT INTO t1 VALUES(1),(2),(3); --source include/start_mysqld.inc -# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open(). # The table does exist, only the tablespace does not exist. ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO SELECT * FROM t; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE; SHOW WARNINGS; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY; SHOW WARNINGS; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY; --error ER_PARSE_ERROR @@ -60,7 +59,7 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE; ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE; ALTER TABLE t DISCARD TABLESPACE; DROP TABLE t; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO SELECT * FROM `x..d`; DROP TABLE `x..d`; diff --git a/mysql-test/suite/innodb/t/missing_tablespaces.test b/mysql-test/suite/innodb/t/missing_tablespaces.test new file mode 100644 index 00000000000..98efc51d7b8 --- /dev/null +++ b/mysql-test/suite/innodb/t/missing_tablespaces.test @@ -0,0 +1,36 @@ +--source include/have_innodb.inc + +#Restarting not supported in embedded +--source include/not_embedded.inc +#Windows has trouble creating files/directories with long names +--source include/not_windows.inc + +--echo # +--echo # Bug#19419026 WHEN A TABLESPACE IS NOT FOUND, DO NOT REPORT "TABLE NOT FOUND" +--echo # + +#Create database and tablename with all special characters + +CREATE DATABASE `..................................................`; +USE `..................................................`; +CREATE TABLE `..................................................` (ID INT) +ENGINE=INNODB; + +--source include/shutdown_mysqld.inc + +--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e/@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.ibd + +--source include/start_mysqld.inc + +--disable_query_log +call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 2 in a file operation."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot open datafile for read-only"); +call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace .* because it could not be opened"); +--enable_query_log + +--error ER_GET_ERRNO +select * from `..................................................`; +DROP TABLE `..................................................`; +DROP DATABASE `..................................................`; diff --git a/mysql-test/suite/innodb/t/truncate_missing.test b/mysql-test/suite/innodb/t/truncate_missing.test index 832b94e3a19..c357f5bae72 100644 --- a/mysql-test/suite/innodb/t/truncate_missing.test +++ b/mysql-test/suite/innodb/t/truncate_missing.test @@ -15,8 +15,8 @@ let $datadir=`select @@datadir`; --remove_file $datadir/test/t.ibd --source include/start_mysqld.inc ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO SELECT * FROM t; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO TRUNCATE TABLE t; DROP TABLE t; diff --git a/mysql-test/suite/mariabackup/missing_ibd.result b/mysql-test/suite/mariabackup/missing_ibd.result index 53989be7c14..7ff63b7d434 100644 --- a/mysql-test/suite/mariabackup/missing_ibd.result +++ b/mysql-test/suite/mariabackup/missing_ibd.result @@ -2,5 +2,5 @@ create table t1(c1 int) engine=InnoDB; INSERT INTO t1 VALUES(1); # xtrabackup backup select * from t1; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB drop table t1; diff --git a/mysql-test/suite/mariabackup/missing_ibd.test b/mysql-test/suite/mariabackup/missing_ibd.test index 22044e59841..ce22616e25d 100644 --- a/mysql-test/suite/mariabackup/missing_ibd.test +++ b/mysql-test/suite/mariabackup/missing_ibd.test @@ -30,7 +30,6 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir rmdir $targetdir; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_GET_ERRNO select * from t1; drop table t1; - diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 26a138046b4..c5ee609da20 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6329,7 +6329,7 @@ no_such_table: if (!thd_tablespace_op(thd) && no_tablespace) { set_my_errno(ENOENT); - int ret_err = HA_ERR_NO_SUCH_TABLE; + int ret_err = HA_ERR_TABLESPACE_MISSING; /* If table has no talespace but it has crypt data, check is tablespace made unaccessible because encryption service @@ -9528,7 +9528,7 @@ ha_innobase::index_read( table->s->table_name.str); table->status = STATUS_NOT_FOUND; - error = HA_ERR_NO_SUCH_TABLE; + error = HA_ERR_TABLESPACE_MISSING; break; case DB_TABLESPACE_NOT_FOUND: @@ -9539,8 +9539,7 @@ ha_innobase::index_read( table->s->table_name.str); table->status = STATUS_NOT_FOUND; - //error = HA_ERR_TABLESPACE_MISSING; - error = HA_ERR_NO_SUCH_TABLE; + error = HA_ERR_TABLESPACE_MISSING; break; default: @@ -9787,7 +9786,7 @@ ha_innobase::general_fetch( table->s->table_name.str); table->status = STATUS_NOT_FOUND; - error = HA_ERR_NO_SUCH_TABLE; + error = HA_ERR_TABLESPACE_MISSING; break; case DB_TABLESPACE_NOT_FOUND: @@ -10097,7 +10096,7 @@ ha_innobase::ft_init_ext( /* If tablespace is discarded, we should return here */ if (dict_table_is_discarded(ft_table)) { - my_error(ER_NO_SUCH_TABLE, MYF(0), table->s->db.str, + my_error(ER_TABLESPACE_MISSING, MYF(0), table->s->db.str, table->s->table_name.str); return(NULL); } @@ -10314,7 +10313,7 @@ next_record: table->s->table_name.str); table->status = STATUS_NOT_FOUND; - error = HA_ERR_NO_SUCH_TABLE; + error = HA_ERR_TABLESPACE_MISSING; break; case DB_TABLESPACE_NOT_FOUND: @@ -15858,7 +15857,7 @@ ha_innobase::external_lock( ER_TABLESPACE_DISCARDED, table->s->table_name.str); - DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); + DBUG_RETURN(HA_ERR_TABLESPACE_MISSING); } row_quiesce_table_start(m_prebuilt->table, trx); |