Bug #90073 | Unexpected ALGORITHM=INPLACE behavior in 8.0 | ||
---|---|---|---|
Submitted: | 14 Mar 2018 14:18 | Modified: | 16 Mar 2018 9:03 |
Reporter: | Kumar Verma (Platinum Quality Contributor) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 8.0.5, 8.0.4, 8.0.3,8.0.2,8.0.1 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[14 Mar 2018 14:18]
Kumar Verma
[16 Mar 2018 9:03]
Nisha Padmini Gopalakrishnan
Posted by developer: In 5.7, the default collation used is utf8mb4_general_ci. Hence when you try to alter the column `text_col` using INPLACE algorithm without specifying any collation i.e alter table mytable1 ALGORITHM=INPLACE, modify `text_col` text CHARACTER SET utf8mb4 NOT NULL; The operation succeeds as there is no change in collation. However on 8.0, the default collation has changed to 'utf8mb4_0900_ai_ci'. This means when you try to ALTER the column without specifying the collation explicitly as mentioned above, the default collation(utf8mb4_0900_ai_ci) is used for the column which is different from the collation used by the column during CREATE TABLE i.e 'utf8mb4_general_ci' Hence changing the collation cannot be done using INPLACE algorithm and an error is reported in 8.0. If needed, the collation for the column can be explicitly specified as in CREATE TABLE and the INPLACE operation succeeds. mysql> alter table mytable1 algorithm=inplace, modify `text_col` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; Query OK, 0 rows affected (0.17 sec) Records: 0 Duplicates: 0 Warnings: 0 Thus marking this report as not a bug.
[16 Mar 2018 13:55]
Simon Mudd
Thank you for the explanation. What seems confusing therefore is the error message. It does not give enough context to make the problem understandable: "Reason: Cannot change column type INPLACE." Can something be done to improve this such as: "Reason: Cannot change column type from utf8mb4/utf8mb4_general_ci to utf8mb4/utf8mb4_0900_ai_ci INPLACE." (or similar) This would make the cause of the problem more visible to users. This type of error is likely to bite anyone who "upgrades via replication" unless they are careful so the clarification would at least point to collation issue which is often overlooked. It may also help others where a collation difference pops up. So extending the error message to be more concise seems useful it that were possible.