Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2, 11.3(EOL), 11.4
Description
monty pointed out that when there are generated stored columns that might have been miscalculated due to an earlier bug, the statement
ALTER TABLE t FORCE; |
would fail to correctly recalculate the generated stored columns. I do not know a specific example of such a bug, but I think that the concern is plausible.
The idea is that we would want the following outcome:
--source include/have_innodb.inc
|
CREATE TABLE t1 (a INT GENERATED ALWAYS AS (42)) ENGINE=InnoDB; |
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; |
--echo # the following would use ALGORITHM=COPY
|
ALTER TABLE t1 FORCE; |
ALTER TABLE t1 ALGORITHM=COPY; |
However, I do not know if this is a good idea. Maybe bugs related to stored generated columns are rare enough that it is enough that the user can explicitly specify ALGORITHM=COPY.
Maybe a better idea would be to introduce a REPAIR option to ALTER TABLE. This option would be mostly like FORCE, but it would instruct InnoDB to refuse a native rebuild in this particular case, as well as in some other column conversions that might not be representable by setting the ALTER_COLUMN_STORAGE_TYPE flag:
--source include/have_innodb.inc
|
CREATE TABLE t1 (a INT GENERATED ALWAYS AS (42)) ENGINE=InnoDB; |
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
ALTER TABLE t1 REPAIR, ALGORITHM=INPLACE; |
--echo # the following would use ALGORITHM=INPLACE
|
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; |
ALTER TABLE t1 FORCE; |
--echo # the following would use ALGORITHM=COPY
|
ALTER TABLE t1 REPAIR; |
ALTER TABLE t1 ALGORITHM=COPY; |
Attachments
Issue Links
- is caused by
-
MDEV-5800 indexes on virtual (not materialized) columns
- Closed
- relates to
-
MDEV-33087 ALTER TABLE...ALGORITHM=COPY should build indexes more efficiently
- Closed