[MDEV-17464] Unfortunate "Unknown error" error message and "Operating system error number 2" log record upon renaming to non-existing database Created: 2018-10-15  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Server, Storage Engine - InnoDB
Affects Version/s: 10.0, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: upstream

Issue Links:
Duplicate
duplicates MDEV-19849 InnoDB should and can be more specifi... Confirmed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
 
RENAME TABLE test.t1 TO non_existing_schema.t1;
 
# Cleanup
DROP TABLE t1;

10.4 a53b99bf13337 (pre-10.4.0)

query 'RENAME TABLE test.t1 TO non_existing_schema.t1' failed: 1025: Error on rename of './test/t1' to './non_existing_schema/t1' (errno: 168 "Unknown (generic) error from engine")

2018-10-16  2:16:40 9 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2018-10-16  2:16:40 9 [ERROR] InnoDB: The error means the system cannot find the path specified.
2018-10-16  2:16:40 9 [ERROR] InnoDB: Cannot rename file './test/t1.ibd' to './non_existing_schema/t1.ibd'

10.0 4d07e6c12da (pre-10.0.37)

query 'RENAME TABLE test.t1 TO non_existing_schema.t1' failed: 1025: Error on rename of './test/t1' to './non_existing_schema/t1' (errno: -1 "Internal error < 0 (Not system error)")

Ideally, it would be something like ER_BAD_DB_ERROR, or at least something more comprehensible.

With MyISAM it's slightly better – no error in the error log, and SQL returns

query 'RENAME TABLE test.t1 TO non_existing_schema.t1' failed: 7: Error on rename of './test/t1.MYI' to './non_existing_schema/t1.MYI' (Errcode: 20 "Not a directory")

With innodb_file_per_table=0 it produces the more elegant

query 'RENAME TABLE test.t1 TO non_existing_schema.t1' failed: 1049: Unknown database 'non_existing_schema'

So I'm filing it for InnoDB, mainly for the record, as one of possible reasons for "Operating system error number 2" which users sometimes complain about.


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