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

ALTER TABLE .. RENAME with COPY algorithm leaves the old table behind

    XMLWordPrintable

Details

    Description

      CREATE TABLE `t+1` (c1 INT);
      ALTER TABLE  `t+1` RENAME `t+2`, ALGORITHM=COPY;
      SHOW TABLES;
       
      # Cleanup
      DROP TABLE IF EXISTS `t+1`,`t+2`;
      

      10.6 e06c6046

      ALTER TABLE  `t+1` RENAME `t+2`, ALGORITHM=COPY;
      Warnings:
      Warning	6	Error on delete of './test/t+1.MYI' (Errcode: 2 "No such file or directory")
      Warning	6	Error on delete of './test/t+1.MYD' (Errcode: 2 "No such file or directory")
      SHOW TABLES;
      Tables_in_test
      t+1
      t+2
      

      10.5 debug additionally features the generic assertion failure:

      10.5 a8b616d1

      mariadbd: /data/src/10.5/sql/protocol.cc:619: void Protocol::end_statement(): Assertion `0' failed.
      230324 16:05:44 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f9008653df2 in __GI___assert_fail (assertion=0x555736f86098 "0", file=0x555736f85c58 "/data/src/10.5/sql/protocol.cc", line=619, function=0x555736f86010 "void Protocol::end_statement()") at ./assert/assert.c:101
      #10 0x000055573607a0f7 in Protocol::end_statement (this=0x7f8fe80013c8) at /data/src/10.5/sql/protocol.cc:619
      #11 0x00005557361b769b in dispatch_command (command=COM_QUERY, thd=0x7f8fe8000dc8, packet=0x7f8fe800b629 "", packet_length=47, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:2476
      #12 0x00005557361b3d72 in do_command (thd=0x7f8fe8000dc8) at /data/src/10.5/sql/sql_parse.cc:1375
      #13 0x0000555736371e39 in do_handle_one_connection (connect=0x5557392e95b8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1416
      #14 0x0000555736371bb5 in handle_one_connection (arg=0x5557392ae128) at /data/src/10.5/sql/sql_connect.cc:1318
      #15 0x00005557368ab7e6 in pfs_spawn_thread (arg=0x5557392e91f8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #16 0x00007f90086a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #17 0x00007f900872866c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The change was first introduced in 10.5.0 by this commit:

      commit 043a3a0176e220e4648521b2e89881c5261e6dd4
      Author: Monty
      Date:   Wed May 8 23:39:29 2019 +0300
       
          Avoid not needed renames in ALTER TABLE
      

      There were intermediate errors upon ALTER after it, and the problem in its current form started happening after

      commit ab38b7511bad8cc03a67f0d43e7169e6dfcac9fa (HEAD)
      Author: Monty
      Date:   Mon Apr 15 18:16:02 2019 +0300
       
          MDEV-17841 S3 storage engine
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            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.