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

Some ALTER TABLE .. fail when they worked before, and with a wrong error message

Details

    Description

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1),(2);
      ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
       
      DROP TABLE t;
      

      ALTER here can have actual operations before ALGORITHM, I just over-simplified it to allow ALTER be executed multiple times without intermediate changes.

      In the above example, before MDEV-16329 ALTER works with ALGORITHM=NOCOPY and ALGORITHM=INSTANT (and of course with COPY and DEFAULT), while fails with ALGORITHM=INPLACE:

      11.2 2867894ac6ca23fc2f82cfad2dd510351f597325

      MariaDB [test]> ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
      Query OK, 2 rows affected (0.044 sec)              
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> ALTER TABLE t ALGORITHM=INPLACE, ORDER BY a;
      ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
      MariaDB [test]> 
      MariaDB [test]> ALTER TABLE t ALGORITHM=INSTANT, ORDER BY a;
      Query OK, 2 rows affected (0.056 sec)              
      Records: 2  Duplicates: 0  Warnings: 0
      

      This is in itself weird, and may be a bug.

      After MDEV-16329 the behavior changed. If the above was indeed a bug, then functionally the change may be correct, but it leaves us with a wrong error message:

      bb-11.2-oalter adcf5dfa8d646b9fbd2bb1a7a4f5a3bb8a7e659c

      MariaDB [test]> ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
      ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
      MariaDB [test]> 
      MariaDB [test]> ALTER TABLE t ALGORITHM=INPLACE, ORDER BY a;
      ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
      MariaDB [test]> 
      MariaDB [test]> ALTER TABLE t ALGORITHM=INSTANT, ORDER BY a;
      ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
      

      Regardless which algorithm is specified, it complains about INPLACE.

      Or, if the old behavior was valid and on whatever reason INPLACE was indeed not applicable, but NOCOPY and INSTANT were, then the new behavior is functionally a regression.

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            Description {code:sql}
            CREATE TABLE t (a INT);
            INSERT INTO t VALUES (1),(2);
            ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;

            DROP TABLE t;
            {code}

            _ALTER here can have actual operations before ALGORITHM, I just over-simplified it to allow ALTER be executed multiple times without intermediate changes._

            In the above example, *before MDEV-16329* ALTER works with ALGORITHM=NOCOPY and ALGORITHM=INSTANT (and of course with COPY and DEFAULT), while fails with {{ALGORITHM=INPLACE}}:
            {code:sql|title=11.2 2867894ac6ca23fc2f82cfad2dd510351f597325}
            MariaDB [test]> ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
            Query OK, 2 rows affected (0.044 sec)
            Records: 2 Duplicates: 0 Warnings: 0

            MariaDB [test]> ALTER TABLE t ALGORITHM=INPLACE, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            MariaDB [test]>
            MariaDB [test]> ALTER TABLE t ALGORITHM=INSTANT, ORDER BY a;
            Query OK, 2 rows affected (0.056 sec)
            Records: 2 Duplicates: 0 Warnings: 0
            {code}

            This is in itself weird, and may be a bug in itself.

            After MDEV-16329 the behavior changed. If the above was indeed a bug, then functionally the change may be correct, but it leaves us with a wrong error message:

            {code:sql|title=bb-11.2-oalter adcf5dfa8d646b9fbd2bb1a7a4f5a3bb8a7e659c}
            MariaDB [test]> ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            MariaDB [test]>
            MariaDB [test]> ALTER TABLE t ALGORITHM=INPLACE, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            MariaDB [test]>
            MariaDB [test]> ALTER TABLE t ALGORITHM=INSTANT, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            {code}

            Regardless which algorithm is specified, it complains about INPLACE.

            Or, if the old behavior was valid and on whatever reason INPLACE was indeed not applicable, but NOCOPY and INSTANT were, then the new behavior is functionally a regression.
            {code:sql}
            CREATE TABLE t (a INT);
            INSERT INTO t VALUES (1),(2);
            ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;

            DROP TABLE t;
            {code}

            _ALTER here can have actual operations before ALGORITHM, I just over-simplified it to allow ALTER be executed multiple times without intermediate changes._

            In the above example, *before MDEV-16329* ALTER works with ALGORITHM=NOCOPY and ALGORITHM=INSTANT (and of course with COPY and DEFAULT), while fails with {{ALGORITHM=INPLACE}}:
            {code:sql|title=11.2 2867894ac6ca23fc2f82cfad2dd510351f597325}
            MariaDB [test]> ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
            Query OK, 2 rows affected (0.044 sec)
            Records: 2 Duplicates: 0 Warnings: 0

            MariaDB [test]> ALTER TABLE t ALGORITHM=INPLACE, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            MariaDB [test]>
            MariaDB [test]> ALTER TABLE t ALGORITHM=INSTANT, ORDER BY a;
            Query OK, 2 rows affected (0.056 sec)
            Records: 2 Duplicates: 0 Warnings: 0
            {code}

            This is in itself weird, and may be a bug.

            After MDEV-16329 the behavior changed. If the above was indeed a bug, then functionally the change may be correct, but it leaves us with a wrong error message:

            {code:sql|title=bb-11.2-oalter adcf5dfa8d646b9fbd2bb1a7a4f5a3bb8a7e659c}
            MariaDB [test]> ALTER TABLE t ALGORITHM=NOCOPY, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            MariaDB [test]>
            MariaDB [test]> ALTER TABLE t ALGORITHM=INPLACE, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            MariaDB [test]>
            MariaDB [test]> ALTER TABLE t ALGORITHM=INSTANT, ORDER BY a;
            ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            {code}

            Regardless which algorithm is specified, it complains about INPLACE.

            Or, if the old behavior was valid and on whatever reason INPLACE was indeed not applicable, but NOCOPY and INSTANT were, then the new behavior is functionally a regression.
            elenst Elena Stepanova made changes -
            Summary ALTER TABLE .. ORDER BY fails when it worked before, and with a wrong error message Some ALTER TABLE .. fail when they worked before, and with a wrong error message
            elenst Elena Stepanova added a comment - - edited

            Same happens upon ENGINE change.

            CREATE TABLE t (a INT) ENGINE=Aria;
            ALTER TABLE t ENGINE=MyISAM, ALGORITHM=NOCOPY;
            SHOW CREATE TABLE t;
            DROP TABLE t;
            

            bb-11.2-oalter adcf5dfa8d6

            mysqltest: At line 2: query 'ALTER TABLE t ENGINE=MyISAM, ALGORITHM=NOCOPY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED (1845): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            

            and upon ALTER on a temporary table

            CREATE TEMPORARY TABLE t (f INT);
            ALTER TABLE t FORCE, ALGORITHM=NOCOPY;
            

            mysqltest: At line 2: query 'ALTER TABLE t FORCE, ALGORITHM=NOCOPY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED (1845): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            

            elenst Elena Stepanova added a comment - - edited Same happens upon ENGINE change. CREATE TABLE t (a INT ) ENGINE=Aria; ALTER TABLE t ENGINE=MyISAM, ALGORITHM=NOCOPY; SHOW CREATE TABLE t; DROP TABLE t; bb-11.2-oalter adcf5dfa8d6 mysqltest: At line 2: query 'ALTER TABLE t ENGINE=MyISAM, ALGORITHM=NOCOPY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED (1845): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY and upon ALTER on a temporary table CREATE TEMPORARY TABLE t (f INT ); ALTER TABLE t FORCE , ALGORITHM=NOCOPY; mysqltest: At line 2: query 'ALTER TABLE t FORCE, ALGORITHM=NOCOPY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED (1845): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
            nikitamalyavin Nikita Malyavin made changes -
            nikitamalyavin Nikita Malyavin made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            nikitamalyavin Nikita Malyavin made changes -
            Assignee Nikita Malyavin [ nikitamalyavin ] Sergei Golubchik [ serg ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            6e6e950c8ab is ok to push

            serg Sergei Golubchik added a comment - 6e6e950c8ab is ok to push
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Nikita Malyavin [ nikitamalyavin ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            nikitamalyavin Nikita Malyavin made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.2.1 [ 29034 ]
            Fix Version/s 11.2 [ 28603 ]
            Resolution Fixed [ 1 ]
            Status In Testing [ 10301 ] Closed [ 6 ]

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.