[MDEV-17301] Change of COLLATE unnecessarily requires ALGORITHM=COPY Created: 2018-09-27 Updated: 2022-09-01 Resolved: 2019-06-22 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table |
| Affects Version/s: | 10.0, 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Eugene Kosov (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | ddl, instant | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
The COLLATE attribute of a column only affects the way how any indexes that are built on the column will be sorted. Thus, it should be possible to change the collation of a column without rebuilding the table, except if the column is part of the PRIMARY KEY. Currently, changing the collation requires the table to be rebuilt with ALGORITHM=COPY, in all cases below:
(When testing versions predating |
| Comments |
| Comment by Marko Mäkelä [ 2018-09-27 ] | |||||||||||||||||||||||||||
|
kevg, this is closely related to | |||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-02-20 ] | |||||||||||||||||||||||||||
|
kevg, is this a duplicate of | |||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-02-20 ] | |||||||||||||||||||||||||||
|
Without remembering about this task, I recently filed
| |||||||||||||||||||||||||||
| Comment by Eugene Kosov (Inactive) [ 2019-04-01 ] | |||||||||||||||||||||||||||
|
Requesting a first round of review. | |||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-04-02 ] | |||||||||||||||||||||||||||
|
I don’t think that we should try to support the table-rebuilding case in InnoDB. The only InnoDB change should be related to determining whether the character encoding of CHAR(n) columns can be changed instantaneously. For ROW_FORMAT=REDUNDANT, InnoDB cannot allow that, because the columns would always be stored as n*mbmaxlen bytes. For other ROW_FORMAT than REDUNDANT, InnoDB can allow instantaneous CHAR(n) changes from utf8mb3 to utf8mb4, because it internally uses a variable-length encoding (n*mbminlen…n*mbmaxlen bytes) when mbminlen!=mbmaxlen. | |||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-05-17 ] | |||||||||||||||||||||||||||
|
Eugene, please adjust your patch on top of the recent changes in 10.4. | |||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-06-21 ] | |||||||||||||||||||||||||||
|
The set of patches in https://github.com/MariaDB/server/commits/bb-10.4-MDEV-17301-charset-nocopy are OK. Ok to push after this (and after fixing buildbot compilation failures). | |||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-09-01 ] | |||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2022-09-01 ] | |||||||||||||||||||||||||||
|
MDEV-29436 has been filed because changing column collation for text still requires COPY algorithm |