mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MDEV-17196 Crash during instant ADD COLUMN with long DEFAULT value
A debug assertion would fail if an instant ADD COLUMN operation involves splitting the leftmost leaf page and storing a default value off-page. Another debug assertion could fail if the default value does not fit in an undo log page. btr_cur_pessimistic_update(): Invoke rec_offs_make_valid() in order to prevent rec_offs_validate() assertion failure. innobase_add_instant_try(): Invoke btr_cur_pessimistic_update() with the BTR_KEEP_POS_FLAG, which is the correct course of action when BLOBs may need to be written. Whenever returning true, ensure that my_error() will have been called.
This commit is contained in:
@@ -464,6 +464,12 @@ ALGORITHM=INSTANT;
|
||||
SET foreign_key_checks=1;
|
||||
ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk;
|
||||
ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1;
|
||||
ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL
|
||||
DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75);
|
||||
CHECK TABLE t2, t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 check status OK
|
||||
test.t1 check status OK
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1
|
||||
(id INT PRIMARY KEY, c2 INT UNIQUE,
|
||||
@@ -875,6 +881,12 @@ ALGORITHM=INSTANT;
|
||||
SET foreign_key_checks=1;
|
||||
ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk;
|
||||
ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1;
|
||||
ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL
|
||||
DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75);
|
||||
CHECK TABLE t2, t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 check status OK
|
||||
test.t1 check status OK
|
||||
DROP TABLE t2, t1;
|
||||
CREATE TABLE t1
|
||||
(id INT PRIMARY KEY, c2 INT UNIQUE,
|
||||
@@ -1286,11 +1298,17 @@ ALGORITHM=INSTANT;
|
||||
SET foreign_key_checks=1;
|
||||
ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk;
|
||||
ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1;
|
||||
ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL
|
||||
DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75);
|
||||
CHECK TABLE t2, t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t2 check status OK
|
||||
test.t1 check status OK
|
||||
DROP TABLE t2, t1;
|
||||
disconnect analyze;
|
||||
SELECT variable_value-@old_instant instants
|
||||
FROM information_schema.global_status
|
||||
WHERE variable_name = 'innodb_instant_alter_column';
|
||||
instants
|
||||
45
|
||||
48
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
|
||||
|
||||
@@ -338,6 +338,9 @@ ALGORITHM=INSTANT;
|
||||
SET foreign_key_checks=1;
|
||||
ALTER TABLE t2 COMMENT 'domestic keys only', DROP FOREIGN KEY fk;
|
||||
ALTER TABLE t1 DROP FOREIGN KEY t1_ibfk_1;
|
||||
ALTER TABLE t1 ADD COLUMN big BLOB NOT NULL
|
||||
DEFAULT REPEAT('a', @@GLOBAL.innodb_page_size * .75);
|
||||
CHECK TABLE t2, t1;
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
dec $format;
|
||||
|
||||
Reference in New Issue
Block a user