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

ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade

Details

    Description

      Here is the repro step.

      1) install 10.1.4 using binary tarballs.
      2) create table

      CREATE TABLE `pet4` ( `build_time` double(18,7) DEFAULT NULL, KEY `idx1` (`build_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 row_format=compact;
      

      3) upgrade the instance with 10.4.25. This can be done by yum/rpm install.
      4) run alter against table created in #2.

      MariaDB [test]> ALTER TABLE pet4 ADD `i1` INTEGER, algorithm=nocopy, lock=none;
      ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE
      

      #4 works without error, when create is created with v10.4.25.

      MariaDB [test]> CREATE TABLE `pet5` (
          ->   `build_time` double(18,7) DEFAULT NULL,
          ->   KEY `idx1` (`build_time`)
          -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
      Query OK, 0 rows affected (0.009 sec)
       
      MariaDB [test]> ALTER TABLE pet5 ADD `i1` INTEGER, algorithm=nocopy, lock=none;
      Query OK, 0 rows affected (0.004 sec)
      Records: 0  Duplicates: 0  Warnings: 0
      

      Attachments

        1. 10.1.48.tar.gz
          656 kB
        2. 10.4.25-after-alter.tar.gz
          333 kB
        3. 10.4.25-before-alter.tar.gz
          330 kB
        4. CS0404325.tar.gz
          664 kB

        Issue Links

          Activity

            Since there is no direct knowledge that only DOUBLE is affected (MDEV-20704 was about FIELDFLAG_BLOB sideffect) I'm going to fix it in most generic way:

            1. if FRM version is prior MDEV-20704 fix CHECK TABLE fails with error:

            test.pet4       check   error   Table rebuild required. Please do "ALTER TABLE `pet4` FORCE" or dump/reload to fix it!
            

            2. mysqlcheck --auto-repair (and mysql_upgrade) when sees such table issues ALTER TABLE FORCE.

            midenok Aleksey Midenkov added a comment - Since there is no direct knowledge that only DOUBLE is affected ( MDEV-20704 was about FIELDFLAG_BLOB sideffect) I'm going to fix it in most generic way: 1. if FRM version is prior MDEV-20704 fix CHECK TABLE fails with error: test.pet4 check error Table rebuild required. Please do "ALTER TABLE `pet4` FORCE" or dump/reload to fix it! 2. mysqlcheck --auto-repair (and mysql_upgrade) when sees such table issues ALTER TABLE FORCE.

            Please review bb-10.4-midenok2

            midenok Aleksey Midenkov added a comment - Please review bb-10.4-midenok2

            OK to push

            sanja Oleksandr Byelkin added a comment - OK to push

            Did I understand the fix correctly that it actually continues to require such tables to be rebuilt when upgrading the server? Is there any way to avoid unnecessarily rebuilding the data of the table, and to adjust or tolerate old-format .frm files?

            marko Marko Mäkelä added a comment - Did I understand the fix correctly that it actually continues to require such tables to be rebuilt when upgrading the server? Is there any way to avoid unnecessarily rebuilding the data of the table, and to adjust or tolerate old-format .frm files?
            marko Marko Mäkelä added a comment - - edited

            I can still reproduce the reported problem with the following test:

            --source include/have_innodb.inc
             
            CREATE TABLE pet4 (build_time double(18,7) DEFAULT NULL, KEY idx1 (build_time))
            ENGINE=InnoDB;
             
            let $datadir=`select @@datadir`;
            FLUSH TABLES;
            remove_file $datadir/test/pet4.frm;
            copy_file std_data/pet4.frm $datadir/test/pet4.frm;
            ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT;
            DROP TABLE pet4;
            

            This is with the pet4.frm from CS0404325.tar.gz:

            tar xzf CS0404325.tar.gz  ./CS0404325/pet4.frm
            mv CS0404325/pet4.frm mysql-test/std_data/
            

            10.4 9a8faeea142ea6f575419799c9439f4673971573

            mysqltest: At line 10: query 'ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT' failed: 1845: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
            

            I intend to fix this in MDEV-29481. As part of that, the previous ‘fix’ would be reverted.

            marko Marko Mäkelä added a comment - - edited I can still reproduce the reported problem with the following test: --source include/have_innodb.inc   CREATE TABLE pet4 (build_time double (18,7) DEFAULT NULL , KEY idx1 (build_time)) ENGINE=InnoDB;   let $datadir=` select @@datadir`; FLUSH TABLES; remove_file $datadir/test/pet4.frm; copy_file std_data/pet4.frm $datadir/test/pet4.frm; ALTER TABLE pet4 ADD i1 INTEGER , ALGORITHM=INSTANT; DROP TABLE pet4; This is with the pet4.frm from CS0404325.tar.gz : tar xzf CS0404325.tar.gz ./CS0404325/pet4.frm mv CS0404325/pet4.frm mysql-test/std_data/ 10.4 9a8faeea142ea6f575419799c9439f4673971573 mysqltest: At line 10: query 'ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT' failed: 1845: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE I intend to fix this in MDEV-29481 . As part of that, the previous ‘fix’ would be reverted.

            People

              midenok Aleksey Midenkov
              allen.lee@mariadb.com Allen Lee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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