Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
The engine API have hooks to let the engine decide if it can perform ALGORITHM=NOCOPY for a minor data type change.
Originally they were implemented to handle ALTER changing a column character set from CHARACTER SET utf8mb3 to CHARACTER SET utf8mb4 without having to rebuild the table:
CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb3) ENGINE=InnoDB; |
INSERT INTO t1 VALUES ('test'); |
ALTER TABLE t1 MODIFY a TEXT CHARACTER SET utf8mb4; |
The above ALTER does not rebuild the table, it only modifies the FRM file.
The hooks that we have so far can handle only string data types. They are implemented in these "class handler" methods, overridden by ha_innodb:
virtual bool can_convert_string(const Field_string *field, |
const Column_definition &new_type) const |
{
|
return false; |
}
|
virtual bool can_convert_varstring(const Field_varstring *field, |
const Column_definition &new_type) const |
{
|
return false; |
}
|
virtual bool can_convert_blob(const Field_blob *field, |
const Column_definition &new_type) const |
{
|
return false; |
}
|
In order to fix MDEV-29481, we may need a hook for the DOUBLE data type.
It's not desirable to add a new "can_convert_double()" method.
Let's remove the above three virtual methods and add one method which can handle any arbitrary data type:
virtual bool can_convert_nocopy(const Field &, |
const Column_definition &) const |
{
|
return false; |
}
|
Attachments
Issue Links
- blocks
-
MDEV-30969 Some ALGORITHM=INSTANT checks are missing from handler::can_convert_nocopy()
- Open
- relates to
-
MDEV-20704 An index on a double column erroneously uses prefix compression
- Closed
-
MDEV-28727 ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade
- Closed
-
MDEV-28822 Table from older version requires table rebuild when adding column to table with multi-column index
- Closed
-
MDEV-29481 mariadb-upgrade prints confusing statement
- Closed