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]> ALTERTABLE t ALGORITHM=NOCOPY, ORDERBY a;
Query OK, 2 rows affected (0.044 sec)
Records: 2 Duplicates: 0 Warnings: 0
MariaDB [test]> ALTERTABLE t ALGORITHM=INPLACE, ORDERBY a;
ERROR 1845 (0A000): ALGORITHM=INPLACE isnot supported for this operation. Try ALGORITHM=COPY
MariaDB [test]>
MariaDB [test]> ALTERTABLE t ALGORITHM=INSTANT, ORDERBY 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:
MariaDB [test]> ALTERTABLE t ALGORITHM=NOCOPY, ORDERBY a;
ERROR 1845 (0A000): ALGORITHM=INPLACE isnot supported for this operation. Try ALGORITHM=COPY
MariaDB [test]>
MariaDB [test]> ALTERTABLE t ALGORITHM=INPLACE, ORDERBY a;
ERROR 1845 (0A000): ALGORITHM=INPLACE isnot supported for this operation. Try ALGORITHM=COPY
MariaDB [test]>
MariaDB [test]> ALTERTABLE t ALGORITHM=INSTANT, ORDERBY a;
ERROR 1845 (0A000): ALGORITHM=INPLACE isnot 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.
{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.
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
CREATETEMPORARYTABLE t (f INT);
ALTERTABLE t FORCE, ALGORITHM=NOCOPY;
mysqltest: At line 2: query 'ALTER TABLE t FORCE, ALGORITHM=NOCOPY' failed: ER_ALTER_OPERATION_NOT_SUPPORTED (1845): ALGORITHM=INPLACE isnot supported for this operation. Try ALGORITHM=COPY
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
Same happens upon ENGINE change.
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