Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4.7, 10.4.12, 10.4(EOL)
-
None
Description
KB article (https://mariadb.com/kb/en/innodb-online-ddl-operations-with-the-instant-alter-algorithm/#alter-table-modify-column) does not list any restrictions related to partitioned tables, while in reality ALGORITHM=INSTANT can not be applied to them.
Consider the following primitive example:
MariaDB [test]> create table tpa(id int, c1 varchar(10)) partition by range(id) (partition p1 values less than (10), partition p2 values less than (1000));
|
Query OK, 0 rows affected (0,310 sec)
|
|
MariaDB [test]> ALTER TABLE tpa MODIFY COLUMN c1 VARCHAR(30), LOCK=NONE, ALGORITHM=INSTANT;
|
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
MariaDB [test]> ALTER TABLE tpa remove partitioning;
|
Query OK, 0 rows affected (0,757 sec)
|
Records: 0 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> ALTER TABLE tpa MODIFY COLUMN c1 VARCHAR(30), LOCK=NONE, ALGORITHM=INSTANT;
|
Query OK, 0 rows affected (0,076 sec)
|
Records: 0 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> select version();
|
+-----------------+
|
| version() |
|
+-----------------+
|
| 10.4.12-MariaDB |
|
+-----------------+
|
1 row in set (0,000 sec)
|
As soon as remove partitioning, ALTER works as expected.
So, please, either document this limitation or fix the bug in the code that does not allow to do INSTANT alters for partitioned tables even in a simplest case like presented above.
Attachments
Issue Links
- relates to
-
MDEV-34813 ALGORITHM=INSTANT does not work for partitioned tables on indexed column
-
- Closed
-
-
MDEV-11369 Instant add column for InnoDB
-
- Closed
-
-
MDEV-13134 Introduce ALTER TABLE attributes ALGORITHM=NOCOPY and ALGORITHM=INSTANT
-
- Closed
-
-
MDEV-15562 Instant DROP COLUMN or changing the order of columns
-
- Closed
-
It is possible that
MDEV-13134failed to adjust some code in ha_partition.A new change in 10.4 is that some restrictions regarding extending VARCHAR columns was lifted. But I think that we should test and potentially fix 10.3 as well.
Note: For
MDEV-11369andMDEV-15562, I think that we must invoke handler::check_if_supported_inplace_alter() on each partition. Depending on the history of the data files, some partitions might support an instant ADD/DROP column operation, while others would require that the table be rebuilt. Currently, the underlying code in ha_innobase assumes that each partition will be handled in the same way. Basically, if some partitions return HA_ALTER_INPLACE_INSTANT while others return something else, then we should set the FORCE flag (ALTER_RECREATE_TABLE) and execute handler::check_if_supported_inplace_alter() on each partition again.