Bug #75911 [ERROR] Got error 155 when reading table './test/t'
Submitted: 15 Feb 2015 21:20 Modified: 25 Nov 2019 22:32
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.7.5-m15 OS:Any
Assigned to: CPU Architecture:Any

[15 Feb 2015 21:20] Roel Van de Paar
Description:
mysql> ALTER TABLE t DISCARD TABLESPACE;
Query OK, 0 rows affected (0.02 sec)

mysql> SELECT * FROM t;
ERROR 1814 (HY000): Tablespace has been discarded for table 't'

Looks understandable. But,

2015-02-15T21:14:08.818312Z 1 [ERROR] Got error 155 when reading table './test/t'

Does not (this is a user-level error, or ??)

$ bin/perror  155
MySQL error code 155: The table does not exist in engine

Looks like the error 155 text can also use an update; "does not exist in engine"?

How to repeat:
DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
SELECT * FROM t;

Suggested fix:
1) Why the ERROR in the log? 
2) Error can be made more descriptive?
3) Fix error 155 to be more descritive/bind to less events (see bug 21751) or tie tablespace discarded to it's own new error number (preferred/seems best)
[15 Feb 2015 22:23] Roel Van de Paar
Further inconsistency;

DROP DATABASE test;CREATE DATABASE test;USE test;
CREATE TABLE t (a INT) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
INSERT INTO t VALUES (2);

mysql> INSERT INTO t VALUES (2);
ERROR 1814 (HY000): Tablespace has been discarded for table 't'

Yet

2015-02-15T22:21:36.941193Z 1 [ERROR] InnoDB: The table test/t doesn't have a corresponding tablespace, it was discarded.
[16 Feb 2015 14:21] MySQL Verification Team
Thank you for the bug report.

C:\dbs>c:\dbs\5.7\bin\mysql -uroot --port=3570 --prompt="mysql 5.7 > "
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.6-m16 Source distribution 2015/02/09

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql 5.7 > DROP DATABASE test;CREATE DATABASE test;USE test;
Query OK, 1 row affected (0.38 sec)

Query OK, 1 row affected (0.00 sec)

Database changed
mysql 5.7 > CREATE TABLE t (a SERIAL) ENGINE=InnoDB;
Query OK, 0 rows affected (0.28 sec)

mysql 5.7 > ALTER TABLE t DISCARD TABLESPACE;
Query OK, 0 rows affected (0.09 sec)

mysql 5.7 > SELECT * FROM t;
ERROR 1814 (HY000): Tablespace has been discarded for table 't'
mysql 5.7 > exit

2015-02-16T13:25:59.639342Z 0 [Note] C:\dbs\5.7\bin\mysqld: ready for connections.
Version: '5.7.6-m16'  socket: ''  port: 3570  Source distribution 2015/02/09
2015-02-16T13:26:50.608618Z 2 [ERROR] Got error 155 when reading table '.\test\t'
[17 Feb 2015 13:37] MySQL Verification Team
Checking where the error 155 comes...

ha_innobase::index_read finds ret with value of DB_TABLESPACE_DELETED (43).
This sends ER_TABLESPACE_DISCARDED (1814) back to the client.

It then sets error to HA_ERR_NO_SUCH_TABLE (155) which is defined in ./include/my_base.h
[19 Feb 2015 13:52] Erlend Dahl
Posted by developer:
 
5.6 behaves in the same way.
[19 Feb 2015 22:52] Roel Van de Paar
"5.6 behaves in the same way." ?
[14 Aug 2015 10:35] Shahriyar Rzayev
Reproducible with 5.6.19-debug:

mysql> select count(*) from news;
ERROR 1814 (HY000): Tablespace has been discarded for table 'news'

From Error log:

2015-08-14 15:31:33 28990 [Warning] InnoDB: Table '"tst1"."news"' tablespace is set as discarded.
2015-08-14 15:31:33 7ffff40a1700 InnoDB: cannot calculate statistics for table "tst1"."news" because the .ibd file is missing. For help, please refer to http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html
2015-08-14 15:31:41 28990 [ERROR] Got error 155 when reading table './tst1/news'
[29 Jul 2019 9:26] Erlend Dahl
Bug#93683 Got error 155 when reading table './test/t1'

was marked as a duplicate.
[25 Nov 2019 22:32] Roy Lyseng
Posted by developer:
 
Fixed in 8.0