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

DDL_LOG: Got error 1032 when trying to execute action for entry 1/2 of type 'rename table' upon RENAME TABLE

Details

    Description

      DROP DATABASE test;
      CREATE DATABASE test;
      USE test;
      INSTALL PLUGIN Spider SONAME 'ha_spider.so';
      CREATE TABLE t1 (c INT) ENGINE=Spider;
      CREATE TABLE t2 (c INT) ENGINE=Spider;
      RENAME TABLE t2 TO doesnotexist.t;
      

      Leads to:

      11.2.5 03807c8449cdccbf5b8afc0dddabb1d8ec7ba85a (Debug)

      11.2.5-dbg>RENAME TABLE t2 TO doesnotexist.t;
      ERROR 1049 (42000): Unknown database 'doesnotexist'
      

      In the client. However, in the error log we see:

      11.2.5 03807c8449cdccbf5b8afc0dddabb1d8ec7ba85a (Debug)

      2024-07-29 10:11:18 4 [ERROR] mariadbd: Can't find record in 'spider_tables'
      2024-07-29 10:11:18 4 [ERROR] DDL_LOG: Got error 1032 when trying to execute action for entry 2 of type 'rename table'
      

      Removing either the DROP/CREATE/USE test db, or the t1 table creation changes the output to:

      11.2.5 03807c8449cdccbf5b8afc0dddabb1d8ec7ba85a (Debug)

      2024-07-29 10:14:54 4 [ERROR] mariadbd: Can't find record in 'spider_tables'
      2024-07-29 10:14:54 4 [ERROR] DDL_LOG: Got error 1032 when trying to execute action for entry 1 of type 'rename table'
      

      Attachments

        Issue Links

          Activity

            MTR Testcase:

            --source plugin/spider/spider/include/init_spider.inc
            SET spider_same_server_link= on;
            DROP DATABASE test;
            CREATE DATABASE test;
            USE test;
            CREATE TABLE t1 (c INT) ENGINE=Spider;
            CREATE TABLE t2 (c INT) ENGINE=Spider;
            --error ER_BAD_DB_ERROR
            RENAME TABLE t2 TO doesnotexist.t;
            # Cleanup
            DROP TABLE t1,t2;
            --source plugin/spider/spider/include/deinit_spider.inc
            

            Roel Roel Van de Paar added a comment - MTR Testcase: --source plugin/spider/spider/include/init_spider.inc SET spider_same_server_link= on ; DROP DATABASE test; CREATE DATABASE test; USE test; CREATE TABLE t1 (c INT ) ENGINE=Spider; CREATE TABLE t2 (c INT ) ENGINE=Spider; --error ER_BAD_DB_ERROR RENAME TABLE t2 TO doesnotexist.t; # Cleanup DROP TABLE t1,t2; --source plugin/spider/spider/include/deinit_spider.inc
            ycp Yuchen Pei added a comment -

            I'm not sure if this is a bug, as everyone seems to be doing what they are supposed to do:

            Renaming fails, so DDL LOG tries to revert the rename, by renaming doesnotexist.t to test.t2. DDL LOG also determines it is spider that is the storage engine responsible for the renaming, presumably because test.t2 is a spider table. Spider cannot find any record about the non-existing table doesnotexist.t in its system table mysql.spdier_tables that stores spider table info, so it fails with "Can't find record in 'spider_tables'".

            I guess it is a 10.6-regression because DDL LOG is added in 10.6.

            ycp Yuchen Pei added a comment - I'm not sure if this is a bug, as everyone seems to be doing what they are supposed to do: Renaming fails, so DDL LOG tries to revert the rename, by renaming doesnotexist.t to test.t2. DDL LOG also determines it is spider that is the storage engine responsible for the renaming, presumably because test.t2 is a spider table. Spider cannot find any record about the non-existing table doesnotexist.t in its system table mysql.spdier_tables that stores spider table info, so it fails with "Can't find record in 'spider_tables'". I guess it is a 10.6-regression because DDL LOG is added in 10.6.
            Roel Roel Van de Paar added a comment - - edited

            ycp Ack, thank you, so if the behaviour is expected, then the CLI error should be the only one, and no error log errors should be produced.

            Also, the errors in the error log are not debugable, or even usable, by the user as no information is provided (i.e. there is not even a table name).

            An error in the error log should likely only be produced, with sufficient info to debug it, when there was a non-recoverable issue, like corruption.

            Roel Roel Van de Paar added a comment - - edited ycp Ack, thank you, so if the behaviour is expected, then the CLI error should be the only one, and no error log errors should be produced. Also, the errors in the error log are not debugable, or even usable, by the user as no information is provided (i.e. there is not even a table name). An error in the error log should likely only be produced, with sufficient info to debug it, when there was a non-recoverable issue, like corruption.

            People

              ycp Yuchen Pei
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.