[MDEV-14046] Allow ALGORITHM=INPLACE for 10.1 tables that contain virtual columns Created: 2017-10-11 Updated: 2022-05-02 Resolved: 2022-01-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.2, 10.3, 10.4 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | online-ddl, performance, upgrade | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | 10.2.11 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
With the dataset of
All of the following statements will lead to the above response:
We must fix this (insert the missing records to SYS_VIRTUAL), so that early users of virtual columns in 10.1 will be able to quickly create indexes on the virtual columns in 10.2 ( |
| Comments |
| Comment by Marko Mäkelä [ 2018-09-13 ] | ||||||
|
Actually, the same error message will be issued even for ALGORITHM=COPY. It makes sense: the table definition includes a virtual column:
This would work in 10.1, where virtual columns cannot be indexed, but in 10.2 after So, the only problem with the mentioned dataset is that the following is refused:
| ||||||
| Comment by Marko Mäkelä [ 2018-09-13 ] | ||||||
|
I am testing the following kind of a fix:
The last part is needed so that ADD COLUMN…VIRTUAL will actually add the metadata to the InnoDB internal dictionary table SYS_VIRTUAL if there was no intermediate ALTER TABLE that would have dropped all virtual columns from the old table. | ||||||
| Comment by Elena Stepanova [ 2018-09-14 ] | ||||||
|
Failure reported in | ||||||
| Comment by Marko Mäkelä [ 2019-03-19 ] | ||||||
|
Note: The following scenario should be covered as well:
Without any fix, we would refuse anything else than ALGORITHM=COPY. With the fix, InnoDB would not be aware of any virtual column metadata. As long as we are dropping virtual columns, nothing would need to be done inside InnoDB, because the virtual columns never existed in the first place, as far as InnoDB is concerned. We could also allow adding non-indexed virtual columns while not updating the InnoDB data dictionary. But, as soon as we add an index on a virtual column, we must make InnoDB aware of all virtual columns. | ||||||
| Comment by Marko Mäkelä [ 2022-01-14 ] | ||||||
|
While this could have been useful to implement, I think that the ship has already sailed, because everyone should already have upgraded from MariaDB Server 10.1, which reached its end of life in October 2020. | ||||||
| Comment by Nuno [ 2022-05-01 ] | ||||||
|
Hi marko I'm on MariaDB 10.5, and I cannot use ALGORITHM=INPLACE if the table has a virtual generated column (indexed). Thanks much. | ||||||
| Comment by Marko Mäkelä [ 2022-05-02 ] | ||||||
|
nunop, before There are several restrictions around native ALTER TABLE and virtual columns. Most of them were inherited from the implementation in MySQL 5.7, and the work-around of | ||||||
| Comment by Nuno [ 2022-05-02 ] | ||||||
|
marko Thank you very much for the clarification! Do you know if there are plans to make Online ALTER TABLE in these scenarios possible? I might need to stop using indexed VIRTUAL columns completely, due to this limitation, unfortunately Thank you very much again. Good day to you. |