Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
Description
The original InnoDB record format (retroactively named ROW_FORMAT=REDUNDANT in MySQL 5.0.3) basically treats every column as variable-length and possibly NULL. That is why we can freely change those columns, by changing the metadata only.
MariaDB 10.2 supports VARCHAR column extension, but only if the maximum length does not change from less than 256 to at least 256 bytes. For ROW_FORMAT=REDUNDANT we should support this unconditionally.
Likewise, for ROW_FORMAT=REDUNDANT we can support the extension of any CHAR column, or converting VARCHAR to a CHAR that is at least as wide.
We can also support converting INT to BIGINT and similar. Maybe also conversion from an unsigned integer to a signed wider integer (such as INT UNSIGNED to BIGINT), but this would require a change to the 'metadata row' format to indicate that the column originally was in unsigned format.
To support instant conversion of CHAR to VARCHAR, we should store a flag in the MDEV-15562 metadata record to indicate that trailing space should be trimmed, just like it would if the table was rebuilt. In this case, any secondary indexes on the column would have to be rebuilt and this is, obviously, not and INSTANT operation:
CREATE TABLE t(a CHAR(2)) ENGINE=InnoDB; |
INSERT INTO t VALUES('a '); |
SELECT HEX(a) FROM t; |
ALTER TABLE t CHANGE a a VARCHAR(2); |
SELECT HEX(a) FROM t; |
DROP TABLE t; |
The above example would read 'a' from the column and not 'a '.
Similarly, for changing INT UNSIGNED to BIGINT we should add a flag that the shorter column was unsigned.
TO BE DETERMINED: On secondary indexes of full columns (not column prefixes), do we have to rebuild the index when the length of a fixed-length column (CHAR, BINARY) is changed?
Attachments
Issue Links
- blocks
-
MDEV-11424 Instant ALTER TABLE of failure-free record format changes
- Closed
-
MDEV-15564 Avoid table rebuild in ALTER TABLE on collation or charset changes
- Closed
- causes
-
MDEV-18124 PK on inplace-enlarged type fails
- Closed
-
MDEV-18596 ASAN unknown-crash in row_mysql_store_col_in_innobase_format upon MODIFY / ADD column
- Closed
-
MDEV-18598 Assertion `is_string == dtype_is_string_type(mtype)' failed in innobase_rename_or_enlarge_columns_cache upon MODIFY column
- Closed
-
MDEV-18623 Assertion `ha_alter_info->key_count + .... in prepare_inplace_alter_table_dict
- Closed
-
MDEV-18627 Wrong result after instant size change of integer
- Closed
-
MDEV-18719 Assertion `!((c.prtype ^ o->prtype) & ~(256U | (16384U|32768U)))' failed in dict_table_t::instant_column
- Closed
-
MDEV-21539 Assertion `!((new_col->prtype ^ col->prtype) & ~256U)' failed in row_log_table_apply_convert_mrec
- Closed
-
MDEV-22465 DROP COLUMN, DROP INDEX is wrongly claimed to be ALGORITHM=INSTANT
- Closed
-
MDEV-25236 Online log apply fails for redundant row format tables
- Closed
- relates to
-
MDEV-16849 Extending indexed VARCHAR column should be instantaneous
- Closed
-
MDEV-18035 InnoDB: Failing assertion: field->col->mtype == type in storage/innobase/row/row0sel.cc line 2549
- Closed
-
MDEV-18649 Assertion `supremum[7] == index.n_core_null_bytes' failed in btr_set_instant
- Closed
-
MDEV-18780 Assertion `col->prtype == prtype' failed in innobase_rename_or_enlarge_column_try upon CHANGE COLUMN
- Confirmed
-
MDEV-22771 Assertion `fields[i].same(instant.fields[i])' failed in dict_index_t::instant_add_field
- Closed
-
MDEV-28060 Online DDL fails while checking for instant alter condition
- Closed
-
MDEV-33069 Instant Modify Column
- Open