Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL)
Description
Apparently InnoDB doesn't copy blob data during online ALTER TABLE. In a meanwhile it calls innobase_rec_reset(), which may reallocate memory for blobs.
It wasn't a problem before column compression was introduced, since in most (if not all) cases memory reallocation was not needed. With compressed columns reallocation is always there.
Grep for MDEV-12586 in source code for relevant markers. Re-enable online ALTER TABLE and run main.column_compression test.
Test not involving column compression:
CREATE TABLE t1(a INT) ENGINE=InnoDB;
|
INSERT INTO t1 VALUES(1),(2),(3);
|
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT REPEAT("a", 5*a);
|
SELECT * FROM t1;
|
a b
|
1 NULL
|
2 NULL
|
3 NULL
|
DROP TABLE t1;
|
CREATE TABLE t1(a INT) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES(1),(2),(3);
|
ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT REPEAT("a", 5*a);
|
SELECT * FROM t1;
|
a b
|
1 aaaaa
|
2 aaaaaaaaaa
|
3 aaaaaaaaaaaaaaa
|
DROP TABLE t1;
|
Attachments
Issue Links
- relates to
-
MDEV-8392 Couldn't alter field with default value for make it not nullable.
-
- Closed
-
-
MDEV-13176 ALTER TABLE…CHANGE col col TIMESTAMP NOT NULL DEFAULT… fails
-
- Closed
-
-
MDEV-13359 Enable online ALTER TABLE for compressed columns
-
- Closed
-
For the record:
ALTER TABLE…ALGORITHM=INPLACE only deals with TABLE::record[] for reporting duplicate key errors. The function innobase_rec_reset() is related to that (reset those columns to NULL for which we do not know the values).
When a table is being rebuilt online, data stored off-page is copied from the old copy of the table. When creating secondary indexes on column prefixes, the necessary prefix of BLOB columns will be written to the sort buffers and online_log and ultimately be inserted into the index.