MDEV-31025 Redundant table alter fails when fixed column

stored externally

row_merge_buf_add(): Has strict assert that fixed length mismatch
shouldn't happen while rebuilding the redundant row format table

btr_index_rec_validate(): Fixed size column can be stored externally.
So sum of inline stored length and external stored length of the
column should be equal to total column length
This commit is contained in:
Thirunarayanan Balathandayuthapani 2023-04-11 18:36:55 +05:30
parent b2bbc66a41
commit 2bfd04e314
4 changed files with 38 additions and 6 deletions

View file

@ -129,5 +129,25 @@ SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
ROW_FORMAT
Dynamic
DROP TABLE t1;
#
# MDEV-31025 Redundant table alter fails when fixed column
# stored externally
#
set @old_sql_mode = @@sql_mode;
SET @@sql_mode='';
CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255),
c4 char(255), c5 char(255), c6 char(255),
c7 char(255), c8 char(255), primary key(pk)
)Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT;
INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255));
ALTER TABLE t1 FORCE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
SELECT LENGTH(c) FROM t1;
LENGTH(c)
1020
DROP TABLE t1;
set @@sql_mode = @old_sql_mode;
# End of 10.4 tests
SET GLOBAL innodb_default_row_format = @row_format;

View file

@ -150,6 +150,23 @@ ALTER TABLE t1 DROP b;
SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1';
DROP TABLE t1;
--echo #
--echo # MDEV-31025 Redundant table alter fails when fixed column
--echo # stored externally
--echo #
set @old_sql_mode = @@sql_mode;
SET @@sql_mode='';
CREATE TABLE t1(pk INT,c CHAR(255),c2 CHAR(255),c3 CHAR(255),
c4 char(255), c5 char(255), c6 char(255),
c7 char(255), c8 char(255), primary key(pk)
)Engine=InnoDB character set utf32 ROW_FORMAT=REDUNDANT;
INSERT INTO t1(pk, c) VALUES (1, repeat('a', 255));
ALTER TABLE t1 FORCE;
CHECK TABLE t1;
SELECT LENGTH(c) FROM t1;
DROP TABLE t1;
set @@sql_mode = @old_sql_mode;
--echo # End of 10.4 tests
SET GLOBAL innodb_default_row_format = @row_format;

View file

@ -4713,7 +4713,7 @@ n_field_mismatch:
len -= BTR_EXTERN_FIELD_REF_SIZE;
ulint extern_len = mach_read_from_4(
data + len + BTR_EXTERN_LEN + 4);
if (fixed_size == extern_len) {
if (fixed_size == extern_len + len) {
goto next_field;
}
}

View file

@ -681,11 +681,6 @@ error:
row_field, field, col->len,
old_table->space->zip_size(),
conv_heap);
} else {
/* Field length mismatch should not
happen when rebuilding redundant row
format table. */
ut_ad(index->table->not_redundant());
}
}
}