Skip to content

Commit 6aaae4c

Browse files
MDEV-35122 Incorrect NULL value handling for instantly dropped BLOB columns
Problem: ======= - Redundant table fails to insert into the table after instant drop blob column. Instant drop column only marking the column as hidden and consecutive insert statement tries to insert NULL value for the dropped BLOB column and returns the fixed length of the blob type as 65535. This lead to row size too large error. Fix: ==== For redundant table, if the non-fixed dropped column can be null then set the length of the field type as 0.
1 parent 77ed235 commit 6aaae4c

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

mysql-test/suite/innodb/r/instant_alter_bugs.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,4 +529,13 @@ c INT as (b) VIRTUAL)ENGINE=InnoDB CHARACTER SET utf32;
529529
ALTER TABLE t1 DROP COLUMN a;
530530
ALTER TABLE t1 DROP COLUMN c;
531531
DROP TABLE t1;
532+
#
533+
# MDEV-35122 Incorrect NULL value handling for instantly
534+
# dropped BLOB columns
535+
#
536+
CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
537+
ALTER TABLE t1 DROP c2;
538+
ALTER TABLE t1 DROP c3;
539+
INSERT INTO t1 VALUES(1);
540+
DROP TABLE t1;
532541
# End of 10.5 tests

mysql-test/suite/innodb/t/instant_alter_bugs.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,4 +565,14 @@ ALTER TABLE t1 DROP COLUMN a;
565565
ALTER TABLE t1 DROP COLUMN c;
566566
DROP TABLE t1;
567567

568+
--echo #
569+
--echo # MDEV-35122 Incorrect NULL value handling for instantly
570+
--echo # dropped BLOB columns
571+
--echo #
572+
CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
573+
ALTER TABLE t1 DROP c2;
574+
ALTER TABLE t1 DROP c3;
575+
INSERT INTO t1 VALUES(1);
576+
DROP TABLE t1;
577+
568578
--echo # End of 10.5 tests

storage/innobase/row/row0row.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,14 @@ row_build_index_entry_low(
250250
dict_col_copy_type(f.col, &dfield->type);
251251
if (f.col->is_nullable()) {
252252
dfield_set_null(dfield);
253+
if (f.col->mtype == DATA_BINARY
254+
&& !dict_table_is_comp(index->table)) {
255+
/* In case of redundant row format,
256+
if the non-fixed dropped column
257+
is null then set the length of the
258+
field data type as 0 */
259+
dfield->type.len= 0;
260+
}
253261
} else {
254262
dfield_set_data(dfield, field_ref_zero,
255263
f.fixed_len);

0 commit comments

Comments
 (0)