[MDEV-18583] Avoid copying when changing the type of an indexed column Created: 2019-02-14 Updated: 2019-03-20 Resolved: 2019-02-20 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 10.4.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Eugene Kosov (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | instant, types | ||
| Issue Links: |
|
||||||||
| Description |
|
It was the intention of Please see the test innodb.instant_alter_charset. We would expect results like
but instead, we currently get the following:
I believe that this is due to the following in Field_str::is_equal() and Field_varstring::is_equal():
Maybe we need variants of IS_EQUAL_PACK_LENGTH and IS_EQUAL_PACK_LENGTH_EXT that indicate that the column is indexed, and therefore the SQL layer must request the indexes to be dropped and added. |
| Comments |
| Comment by Eugene Kosov (Inactive) [ 2019-02-18 ] | ||||||||||||||||||||||||
|
Issue description is a bit incorrect. It's possible to change charset of an indexed field, e.g.:
What requires copy is key part tests like this one:
This requires copy because CHAR can't be changed instantly. When I change type to VARCHAR it requires NOCOPY which is fine. I think there is nothing to do with that issue at all. What do you think marko? | ||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-02-20 ] | ||||||||||||||||||||||||
|
kevg, thanks for the observation. Do we already have test cases that cover the instantaneous change of VARCHAR, followed by possible rebuild of the indexes that depend on the columns? If not, then such tests should be added. Related question, possibly to be answered by bar: Do we always have to rebuild indexes when changing from utf8mb3 to utf8mb4? Are there any utf8mb4 collations that are guaranteed to sort utf8mb3 data in the same way as an some particular utf8mb3 collation? For example, it would seem to me that we could instantly convert from utf8mb3_bin or utf8_bin to utf8mb4_bin. | ||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-02-20 ] | ||||||||||||||||||||||||
|
This is a duplicate of |