[MDEV-19849] InnoDB should and can be more specific with errno: 168 "Unknown (generic) error from engine". The output for MyISAM, Aria and RocksDB can also be improved. Created: 2019-06-24  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Storage Engine - Aria, Storage Engine - InnoDB, Storage Engine - MyISAM, Storage Engine - RocksDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Major
Reporter: Valerii Kravchuk Assignee: Vladislav Lesin
Resolution: Unresolved Votes: 1
Labels: affects-tests, beginner-friendly, upstream-5.6, upstream-5.7

Issue Links:
Duplicate
is duplicated by MDEV-17464 Unfortunate "Unknown error" error mes... Open
is duplicated by MDEV-28831 Improve and unify error messages on A... Closed
Relates
relates to MDEV-20711 Unexpected 'Unknown .. error from eng... Closed

 Description   

In some cases (see MDEV-19449 or upstream https://bugs.mysql.com/bug.php?id=86253 for examples) InnoDB returns error 168 to the user with a generic error message that is not useful at all, while in error log it produces way more specific messages pointing out the root cause. Consider this test case from upstream bug mentioned above:

MariaDB [test]> drop table t1;
Query OK, 0 rows affected (0.416 sec)
 
MariaDB [test]> CREATE TABLE t1(c1 INT KEY,old1 DOUBLE,new1 DOUBLE,old2 DOUBLE,new2 DOUBLE);
Query OK, 0 rows affected (2.031 sec)
 
MariaDB [test]> RENAME TABLE t1 TO doesnotexist.t1;
ERROR 1025 (HY000): Error on rename of '.\test\t1' to '.\doesnotexist\t1' (errno: 168 "Unknown (generic) error from engine")

The error says nothing to the user about the reason of the problem. In the error log we see:

2019-06-24 19:08:58 9 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2019-06-24 19:08:58 9 [ERROR] InnoDB: The error means the system cannot find the path specified.
2019-06-24 19:08:58 9 [ERROR] InnoDB: File .\test\t1.ibd: 'rename' returned OS error 203.

that is way more specific. I think that returning a generic "Unknown" error when the reason for the error is well known is wrong.



 Comments   
Comment by Kathryn Sizemore [ 2020-02-26 ]

This is still a bug in 10.4.12. We encountered the same unhelpful error.

Comment by Roel Van de Paar [ 2022-10-14 ]

I ran into this also:

CREATE TABLE t (c CHAR(6)) CHARSET=utf8 ENGINE=InnoDB;
RENAME TABLE t TO t.t;  # Where database 't' does not exist

Leads to (in 10.8+):

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

10.11.0-dbg>RENAME TABLE t TO t.t;
ERROR 1025 (HY000): Error on rename of './test/t' to './t/t' (errno: 168 "Unknown (generic) error from engine")

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

Version: '10.11.0-MariaDB-debug'  socket: '/test/MD190922-mariadb-10.11.0-linux-x86_64-dbg/socket.sock'  port: 11218  MariaDB Server
2022-10-14 16:32:30 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2022-10-14 16:32:30 4 [ERROR] InnoDB: Error number 2 means 'No such file or directory'
2022-10-14 16:32:30 4 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2022-10-14 16:32:30 4 [ERROR] InnoDB: Cannot rename file './test/t.ibd' to './t/t.ibd'

As well as (in 10.3-10.7):

10.7.6 f3785f099c2f0f251f39632928e822328abe9a02 (Debug)

10.7.6-dbg>RENAME TABLE t TO t.t;
ERROR 1025 (HY000): Error on rename of './test/t' to './t/t' (errno: 168 "Unknown (generic) error from engine")

10.7.6 f3785f099c2f0f251f39632928e822328abe9a02 (Debug)

2022-10-14 16:32:33 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2022-10-14 16:32:33 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
2022-10-14 16:32:33 4 [ERROR] InnoDB: Cannot rename file './test/t.ibd' to './t/t.ibd'

Bug confirmed present in:
MariaDB: 10.3.37 (dbg), 10.3.37 (opt), 10.4.27 (dbg), 10.4.27 (opt), 10.5.16 (opt), 10.5.18 (dbg), 10.5.18 (opt), 10.6.10 (dbg), 10.6.10 (opt), 10.7.6 (dbg), 10.7.6 (opt), 10.8.5 (dbg), 10.8.5 (opt), 10.9.3 (dbg), 10.9.3 (opt), 10.10.2 (dbg), 10.10.2 (opt), 10.11.0 (dbg), 10.11.0 (opt)
MySQL: 5.6.51 (dbg), 5.6.51 (opt), 5.7.38 (dbg), 5.7.38 (opt)

Bug (or feature/syntax) confirmed not present in:
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 8.0.29 (dbg), 8.0.29 (opt)

Comment by Roel Van de Paar [ 2022-10-14 ]

MyISAM and Aria output:

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

10.11.0-dbg>CREATE TABLE t (c CHAR(6)) CHARSET=utf8 ENGINE=MyISAM;
Query OK, 0 rows affected (0.013 sec)
 
10.11.0-dbg>RENAME TABLE t TO t.t;
ERROR 7 (HY000): Error on rename of './test/t.MYI' to './t/t.MYI' (Errcode: 20 "Not a directory")

MEMORY and Spider output:

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

10.11.0-dbg>CREATE TABLE t (c CHAR(6)) CHARSET=utf8 ENGINE=MEMORY;
Query OK, 0 rows affected (0.011 sec)
 
10.11.0-dbg>RENAME TABLE t TO t.t;
ERROR 1049 (42000): Unknown database 't'

The MEMORY/Spider output looks the best imho.

Comment by Roel Van de Paar [ 2022-10-14 ]

Actually, ERROR 7 looks incorrect:

$ ./bin/perror 7
OS error code   7:  Argument list too long

It would be best imho to change InnoDB, MyISAM, and Aria to:

ERROR 1049 (42000): Unknown database 't'

Comment by Roel Van de Paar [ 2022-10-14 ]

For RocksDB:

INSTALL SONAME 'ha_rocksdb.so';
CREATE TABLE t (c INT) ENGINE=rocksdb;
ALTER TABLE t RENAME a.t;

Leads to:

10.10.0 081a284712bb661349e2e3802077b12211cede3e (Optimized)

10.10.0-opt>ALTER TABLE t RENAME a.t;
ERROR 1025 (HY000): Error on rename of './test/t' to './a/t' (errno: -1 "Internal error < 0 (Not system error)")

Comment by Roel Van de Paar [ 2023-01-13 ]

Another example:

CREATE TABLE t(c INT) ENGINE=InnoDB;
RENAME TABLE t TO `......................................................`;

Leads to:

11.0.1 b075191ba8598af6aff5549e6e19f6255aef258a (Debug)

11.0.1-dbg>RENAME TABLE t TO `......................................................`;
ERROR 1025 (HY000): Error on rename of './test/t' to './test/@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@00' (errno: 168 "Unknown (generic) error from engine")

Which is non-descriptive. The issue in this case is error 36 (file name too long):

data$ touch './test/@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'
touch: cannot touch './test/@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': File name too long

And this matches the error log:

11.0.1 b075191ba8598af6aff5549e6e19f6255aef258a (Debug)

2023-01-13 18:38:29 0 [Note] /test/MD090123-mariadb-11.0.1-linux-x86_64-dbg/bin/mysqld: ready for connections.
Version: '11.0.1-MariaDB-debug'  socket: '/test/MD090123-mariadb-11.0.1-linux-x86_64-dbg/socket.sock'  port: 10085  MariaDB Server
2023-01-13 18:38:45 4 [ERROR] InnoDB: Operating system error number 36 in a file operation.
2023-01-13 18:38:45 4 [ERROR] InnoDB: Error number 36 means 'File name too long'
2023-01-13 18:38:45 4 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2023-01-13 18:38:45 4 [ERROR] InnoDB: Cannot rename file './test/t.ibd' to './test/@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'

Comment by Neama Ageb [ 2023-09-20 ]

I have the same issue too ... I have MariaDB 10.6
My customer tries to do some upgrades in his applications ... during this upgrade he is trying to rename some tables or alter some fields in the existing tables, and he got the same error too.
rename table portal_policy_information to portal_bbc_budget2;
ERROR 1025 (HY000): Error on rename of './SUITE_OVERHEIDSLOKET_RELEASE/portal_policy_information' to './SUITE_OVERHEIDSLOKET_RELEASE/portal_bbc_budget2' (errno: 168 "Unknown (generic) error from engine")

ALTER TABLE SUITE_OVERHEIDSLOKET_RELEASE.portal_policy_information MODIFY id INT AUTO_INCREMENT;
ERROR 1025 (HY000): Error on rename of './SUITE_OVERHEIDSLOKET_RELEASE/portal_policy_information' to './SUITE_OVERHEIDSLOKET_RELEASE/#sql-backup-d1586-2f8c9' (errno: 168 "Unknown (generic) error from engine")

Comment by Roel Van de Paar [ 2023-09-27 ]

Na3omy Looks related. You can check the error log for more information.

Comment by Neama Ageb [ 2023-10-03 ]

Hello
it seems this issue exist in MariaDB 10.6.4 but not exist in MariaDB 10.6.7.
I did a manual installation to 10.6.7 and my issue is fixed.

Comment by Roel Van de Paar [ 2023-10-04 ]

I suspect the underlying issue disappeared whereas the original description of this ticket remains as-is. Thank you for the update!

Generated at Thu Feb 08 08:54:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.