mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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"
This commit is contained in:
@ -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;
|
||||
|
11
mysql-test/suite/innodb/r/missing_tablespaces.result
Normal file
11
mysql-test/suite/innodb/r/missing_tablespaces.result
Normal file
@ -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 `..................................................`;
|
@ -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;
|
||||
|
@ -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`;
|
||||
|
||||
|
36
mysql-test/suite/innodb/t/missing_tablespaces.test
Normal file
36
mysql-test/suite/innodb/t/missing_tablespaces.test
Normal file
@ -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 `..................................................`;
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user