Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17464

Unfortunate "Unknown error" error message and "Operating system error number 2" log record upon renaming to non-existing database

    Details

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: