1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fix Bug #14753402 - FAILING ASSERTION: LEN == IFIELD->FIXED_LEN

rb://1411 approved by Marko
This commit is contained in:
Jimmy Yang
2012-11-14 17:00:41 +08:00
parent c2f4a4af29
commit e42cd2db91
4 changed files with 49 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
CREATE TABLE bug14753402(a34 INT, col8953 NATIONAL CHAR(231) NOT NULL)
ENGINE=INNODB ROW_FORMAT=REDUNDANT;
INSERT INTO bug14753402 VALUES(1, 'aa');
CREATE INDEX idx1 ON bug14753402(col8953(165));
DROP TABLE bug14753402;

View File

@@ -0,0 +1,13 @@
#
# Test Bug 14753402 - FAILING ASSERTION: LEN == IFIELD->FIXED_LEN
#
-- source include/have_innodb.inc
CREATE TABLE bug14753402(a34 INT, col8953 NATIONAL CHAR(231) NOT NULL)
ENGINE=INNODB ROW_FORMAT=REDUNDANT;
INSERT INTO bug14753402 VALUES(1, 'aa');
CREATE INDEX idx1 ON bug14753402(col8953(165));
DROP TABLE bug14753402;

View File

@@ -819,10 +819,19 @@ rec_get_converted_size_comp_prefix(
it is 128 or more, or when the field is stored externally. */ it is 128 or more, or when the field is stored externally. */
if (field->fixed_len) { if (field->fixed_len) {
ut_ad(len == field->fixed_len); #ifdef UNIV_DEBUG
ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen);
ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen);
ut_ad(len <= field->fixed_len);
ut_ad(!mbmaxlen || len >= mbminlen
* (field->fixed_len / mbmaxlen));
/* dict_index_add_col() should guarantee this */ /* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len ut_ad(!field->prefix_len
|| field->fixed_len == field->prefix_len); || field->fixed_len == field->prefix_len);
#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(&fields[i])) { } else if (dfield_is_ext(&fields[i])) {
ut_ad(col->len >= 256 || col->mtype == DATA_BLOB); ut_ad(col->len >= 256 || col->mtype == DATA_BLOB);
extra_size += 2; extra_size += 2;
@@ -1169,8 +1178,17 @@ rec_convert_dtuple_to_rec_comp(
0..127. The length will be encoded in two bytes when 0..127. The length will be encoded in two bytes when
it is 128 or more, or when the field is stored externally. */ it is 128 or more, or when the field is stored externally. */
if (fixed_len) { if (fixed_len) {
ut_ad(len == fixed_len); #ifdef UNIV_DEBUG
ulint mbminlen = DATA_MBMINLEN(
ifield->col->mbminmaxlen);
ulint mbmaxlen = DATA_MBMAXLEN(
ifield->col->mbminmaxlen);
ut_ad(len <= fixed_len);
ut_ad(!mbmaxlen || len >= mbminlen
* (fixed_len / mbmaxlen));
ut_ad(!dfield_is_ext(field)); ut_ad(!dfield_is_ext(field));
#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(field)) { } else if (dfield_is_ext(field)) {
ut_ad(ifield->col->len >= 256 ut_ad(ifield->col->len >= 256
|| ifield->col->mtype == DATA_BLOB); || ifield->col->mtype == DATA_BLOB);

View File

@@ -347,8 +347,18 @@ row_merge_buf_add(
ut_ad(len <= col->len || col->mtype == DATA_BLOB); ut_ad(len <= col->len || col->mtype == DATA_BLOB);
if (ifield->fixed_len) { if (ifield->fixed_len) {
ut_ad(len == ifield->fixed_len); #ifdef UNIV_DEBUG
ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen);
ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen);
/* len should be between size calcualted base on
mbmaxlen and mbminlen */
ut_ad(len <= ifield->fixed_len);
ut_ad(!mbmaxlen || len >= mbminlen
* (ifield->fixed_len / mbmaxlen));
ut_ad(!dfield_is_ext(field)); ut_ad(!dfield_is_ext(field));
#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(field)) { } else if (dfield_is_ext(field)) {
extra_size += 2; extra_size += 2;
} else if (len < 128 } else if (len < 128