MDEV-22855 Assertion `!field->prefix_len || field->fixed_len ==...

MDEV-22855 Assertion `!field->prefix_len || field->fixed_len == field->prefix_len' failed in btr_node_ptr_max_size

Problem:
========
- InnoDB wrongly calulates the record size in
btr_node_ptr_max_size() when prefix index of
the column has to be stored externally.

Fix:
====
- InnoDB should add the maximum field size to
record size when the field is a fixed length one.
parent 3f2a5b28
...@@ -20,4 +20,12 @@ FLOOR(index_length/@@innodb_page_size) ...@@ -20,4 +20,12 @@ FLOOR(index_length/@@innodb_page_size)
2 2
disconnect stop_purge; disconnect stop_purge;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-22855 Assertion (!field->prefix_len ||
# field->fixed_len == field->prefix_len)
# failed in btr_node_ptr_max_size
#
CREATE TABLE t1(c CHAR(194) CHARACTER SET UTF32, KEY k1(c(193)))ENGINE=InnoDB;
INSERT INTO t1 SET c='';
DROP TABLE t1;
# End of 10.4 tests # End of 10.4 tests
...@@ -20,4 +20,12 @@ WHERE table_schema = 'test' AND table_name = 't1'; ...@@ -20,4 +20,12 @@ WHERE table_schema = 'test' AND table_name = 't1';
disconnect stop_purge; disconnect stop_purge;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-22855 Assertion (!field->prefix_len ||
--echo # field->fixed_len == field->prefix_len)
--echo # failed in btr_node_ptr_max_size
--echo #
CREATE TABLE t1(c CHAR(194) CHARACTER SET UTF32, KEY k1(c(193)))ENGINE=InnoDB;
INSERT INTO t1 SET c='';
DROP TABLE t1;
--echo # End of 10.4 tests --echo # End of 10.4 tests
...@@ -1126,7 +1126,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index) ...@@ -1126,7 +1126,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index)
/* Determine the maximum length of the index field. */ /* Determine the maximum length of the index field. */
field_max_size = dict_col_get_fixed_size(col, comp); field_max_size = dict_col_get_fixed_size(col, comp);
if (field_max_size) { if (field_max_size && field->fixed_len) {
/* 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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment