diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2021-03-01 21:16:13 +0530 |
---|---|---|
committer | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2021-03-03 17:20:43 +0530 |
commit | b044898b97729c36dd22e1133e47c92ed7c42e04 (patch) | |
tree | 0b31170c2b09a26d13168d127becfd5b79c4be64 | |
parent | f080863501972af381877c6c2335b8dcf3e87830 (diff) | |
download | mariadb-git-b044898b97729c36dd22e1133e47c92ed7c42e04.tar.gz |
MDEV-24748 extern column check missing in btr_index_rec_validate()
In btr_index_rec_validate(), externally stored column
check is missing while matching the length of the field
with the length of the field data stored in record.
Fetch the length of the externally stored part and compare it
with the fixed field length.
-rw-r--r-- | mysql-test/suite/innodb/r/innodb.result | 17 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb.test | 18 | ||||
-rw-r--r-- | storage/innobase/btr/btr0btr.cc | 12 |
3 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index ace226781c0..326aed06901 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -3373,3 +3373,20 @@ c1 c2 9 3 DROP TABLE t1; DROP TABLE t2; +# +# MDEV-24748 Extern field check missing +# in btr_index_rec_validate() +# +CREATE TABLE t1 (pk INT, c1 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) +) CHARACTER SET utf32 ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'), +(2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 FORCE; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test index 7aa146d7d99..d494f40bcb6 100644 --- a/mysql-test/suite/innodb/t/innodb.test +++ b/mysql-test/suite/innodb/t/innodb.test @@ -2628,3 +2628,21 @@ SELECT * FROM t2; DROP TABLE t1; DROP TABLE t2; + +--echo # +--echo # MDEV-24748 Extern field check missing +--echo # in btr_index_rec_validate() +--echo # +CREATE TABLE t1 (pk INT, c1 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) +) CHARACTER SET utf32 ENGINE=InnoDB; + +INSERT INTO t1 VALUES + (1, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'), + (2, 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'); +CHECK TABLE t1; +ALTER TABLE t1 FORCE; +# Cleanup +DROP TABLE t1; diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 511ac66d58c..f7fe4413086 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -4519,6 +4519,18 @@ btr_index_rec_validate( rec_get_nth_field_offs(offsets, i, &len); + if (rec_offs_nth_extern(offsets, i)) { + + const byte* data = rec_get_nth_field( + rec, offsets, i, &len); + len -= BTR_EXTERN_FIELD_REF_SIZE; + ulint extern_len = mach_read_from_4( + data + len + BTR_EXTERN_LEN + 4); + if (fixed_size == extern_len) { + continue; + } + } + /* Note that if fixed_size != 0, it equals the length of a fixed-size column in the clustered index. We should adjust it here. |