Commit 92feac53 authored by Marko Mäkelä's avatar Marko Mäkelä

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"
parent 6d2b2365
...@@ -8,23 +8,23 @@ CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; ...@@ -8,23 +8,23 @@ CREATE TABLE `x..d` (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
CREATE TABLE t1(a SERIAL)ENGINE=InnoDB; CREATE TABLE t1(a SERIAL)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1),(2),(3); INSERT INTO t1 VALUES(1),(2),(3);
SELECT * FROM t; 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; 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; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1812 Tablespace is missing for table 'test/t' 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; 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; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1812 Tablespace is missing for table 'test/t' 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; 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; 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; 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 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; ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
...@@ -37,7 +37,7 @@ Warning 1812 Tablespace is missing for table 'test/t' ...@@ -37,7 +37,7 @@ Warning 1812 Tablespace is missing for table 'test/t'
Warning 1812 Tablespace is missing for table 'test/t' Warning 1812 Tablespace is missing for table 'test/t'
DROP TABLE t; DROP TABLE t;
SELECT * FROM `x..d`; 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`; DROP TABLE `x..d`;
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;
ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=INPLACE; ALTER TABLE t1 AUTO_INCREMENT=1, ALGORITHM=INPLACE;
......
#
# 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 `..................................................`;
...@@ -11,7 +11,7 @@ t CREATE TABLE `t` ( ...@@ -11,7 +11,7 @@ t CREATE TABLE `t` (
UNIQUE KEY `a` (`a`) UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
SELECT * FROM t; 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; 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; DROP TABLE t;
...@@ -34,22 +34,21 @@ INSERT INTO t1 VALUES(1),(2),(3); ...@@ -34,22 +34,21 @@ INSERT INTO t1 VALUES(1),(2),(3);
--source include/start_mysqld.inc --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. # The table does exist, only the tablespace does not exist.
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
SELECT * FROM t; SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE; ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
SHOW WARNINGS; SHOW WARNINGS;
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY; ALTER TABLE t ADD INDEX (a), ALGORITHM=COPY;
SHOW WARNINGS; SHOW WARNINGS;
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=INPLACE; 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; ALTER TABLE t AUTO_INCREMENT=1, ALGORITHM=COPY;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
...@@ -60,7 +59,7 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE; ...@@ -60,7 +59,7 @@ ALTER TABLE t ALGORITHM=COPY, DISCARD TABLESPACE;
ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE; ALTER TABLE t ALGORITHM=DEFAULT, DISCARD TABLESPACE;
ALTER TABLE t DISCARD TABLESPACE; ALTER TABLE t DISCARD TABLESPACE;
DROP TABLE t; DROP TABLE t;
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
SELECT * FROM `x..d`; SELECT * FROM `x..d`;
DROP TABLE `x..d`; DROP TABLE `x..d`;
......
--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 `..................................................`;
...@@ -15,8 +15,8 @@ let $datadir=`select @@datadir`; ...@@ -15,8 +15,8 @@ let $datadir=`select @@datadir`;
--remove_file $datadir/test/t.ibd --remove_file $datadir/test/t.ibd
--source include/start_mysqld.inc --source include/start_mysqld.inc
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
SELECT * FROM t; SELECT * FROM t;
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
TRUNCATE TABLE t; TRUNCATE TABLE t;
DROP TABLE t; DROP TABLE t;
...@@ -2,5 +2,5 @@ create table t1(c1 int) engine=InnoDB; ...@@ -2,5 +2,5 @@ create table t1(c1 int) engine=InnoDB;
INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(1);
# xtrabackup backup # xtrabackup backup
select * from t1; 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; drop table t1;
...@@ -30,7 +30,6 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir ...@@ -30,7 +30,6 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir
rmdir $targetdir; rmdir $targetdir;
--error ER_NO_SUCH_TABLE_IN_ENGINE --error ER_GET_ERRNO
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -6329,7 +6329,7 @@ ha_innobase::open(const char* name, int, uint) ...@@ -6329,7 +6329,7 @@ ha_innobase::open(const char* name, int, uint)
if (!thd_tablespace_op(thd) && no_tablespace) { if (!thd_tablespace_op(thd) && no_tablespace) {
set_my_errno(ENOENT); 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 /* If table has no talespace but it has crypt data, check
is tablespace made unaccessible because encryption service is tablespace made unaccessible because encryption service
...@@ -9528,7 +9528,7 @@ ha_innobase::index_read( ...@@ -9528,7 +9528,7 @@ ha_innobase::index_read(
table->s->table_name.str); table->s->table_name.str);
table->status = STATUS_NOT_FOUND; table->status = STATUS_NOT_FOUND;
error = HA_ERR_NO_SUCH_TABLE; error = HA_ERR_TABLESPACE_MISSING;
break; break;
case DB_TABLESPACE_NOT_FOUND: case DB_TABLESPACE_NOT_FOUND:
...@@ -9539,8 +9539,7 @@ ha_innobase::index_read( ...@@ -9539,8 +9539,7 @@ ha_innobase::index_read(
table->s->table_name.str); table->s->table_name.str);
table->status = STATUS_NOT_FOUND; table->status = STATUS_NOT_FOUND;
//error = HA_ERR_TABLESPACE_MISSING; error = HA_ERR_TABLESPACE_MISSING;
error = HA_ERR_NO_SUCH_TABLE;
break; break;
default: default:
...@@ -9787,7 +9786,7 @@ ha_innobase::general_fetch( ...@@ -9787,7 +9786,7 @@ ha_innobase::general_fetch(
table->s->table_name.str); table->s->table_name.str);
table->status = STATUS_NOT_FOUND; table->status = STATUS_NOT_FOUND;
error = HA_ERR_NO_SUCH_TABLE; error = HA_ERR_TABLESPACE_MISSING;
break; break;
case DB_TABLESPACE_NOT_FOUND: case DB_TABLESPACE_NOT_FOUND:
...@@ -10097,7 +10096,7 @@ ha_innobase::ft_init_ext( ...@@ -10097,7 +10096,7 @@ ha_innobase::ft_init_ext(
/* If tablespace is discarded, we should return here */ /* If tablespace is discarded, we should return here */
if (dict_table_is_discarded(ft_table)) { 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); table->s->table_name.str);
return(NULL); return(NULL);
} }
...@@ -10314,7 +10313,7 @@ ha_innobase::ft_read( ...@@ -10314,7 +10313,7 @@ ha_innobase::ft_read(
table->s->table_name.str); table->s->table_name.str);
table->status = STATUS_NOT_FOUND; table->status = STATUS_NOT_FOUND;
error = HA_ERR_NO_SUCH_TABLE; error = HA_ERR_TABLESPACE_MISSING;
break; break;
case DB_TABLESPACE_NOT_FOUND: case DB_TABLESPACE_NOT_FOUND:
...@@ -15858,7 +15857,7 @@ ha_innobase::external_lock( ...@@ -15858,7 +15857,7 @@ ha_innobase::external_lock(
ER_TABLESPACE_DISCARDED, ER_TABLESPACE_DISCARDED,
table->s->table_name.str); 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); row_quiesce_table_start(m_prebuilt->table, trx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment