Skip to content

Commit

Permalink
MDEV-31025 Redundant table alter fails when fixed column
Browse files Browse the repository at this point in the history
			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
  • Loading branch information
Thirunarayanan committed Apr 19, 2023
1 parent b2bbc66 commit 2bfd04e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
20 changes: 20 additions & 0 deletions mysql-test/suite/innodb/r/default_row_format_alter.result
Expand Up @@ -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;
17 changes: 17 additions & 0 deletions mysql-test/suite/innodb/t/default_row_format_alter.test
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion storage/innobase/btr/btr0btr.cc
Expand Up @@ -4713,7 +4713,7 @@ btr_index_rec_validate(
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;
}
}
Expand Down
5 changes: 0 additions & 5 deletions storage/innobase/row/row0merge.cc
Expand Up @@ -681,11 +681,6 @@ row_merge_buf_add(
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());
}
}
}
Expand Down

0 comments on commit 2bfd04e

Please sign in to comment.