Commit ae35057b authored by unknown's avatar unknown

InnoDB: Fix ctype_utf8 test failure caused by the new record format.


innobase/btr/btr0btr.c:
  Cache the value of dtype_get_fixed_size(type) in order to avoid
  repeated calls to an external function innobase_is_mb_cset()
innobase/include/data0type.ic:
  Declare innobase_is_mb_cset().
  dtype_get_fixed_size(): Invoke innobase_is_mb_cset() for DATA_MYSQL.
innobase/row/row0ins.c:
  Cache the value of dtype_get_fixed_size(type) in order to avoid
  repeated calls to an external function innobase_is_mb_cset()
innobase/row/row0sel.c:
  row_search_for_mysql(): Added a missing rec_reget_offsets() call
  that caused an InnoDB debug assertion failure in ctype_utf8 test.
sql/ha_innodb.cc:
  Define innobase_is_mb_cset().
parent 7acebdbd
......@@ -2515,6 +2515,7 @@ btr_index_rec_validate(
for (i = 0; i < n; i++) {
dtype_t* type = dict_index_get_nth_type(index, i);
ulint fixed_size = dtype_get_fixed_size(type);
rec_get_nth_field(rec, offsets, i, &len);
......@@ -2522,8 +2523,8 @@ btr_index_rec_validate(
their type is CHAR. */
if ((dict_index_get_nth_field(index, i)->prefix_len == 0
&& len != UNIV_SQL_NULL && dtype_is_fixed_size(type)
&& len != dtype_get_fixed_size(type))
&& len != UNIV_SQL_NULL && fixed_size
&& len != fixed_size)
||
(dict_index_get_nth_field(index, i)->prefix_len > 0
&& len != UNIV_SQL_NULL
......
......@@ -8,6 +8,17 @@ Created 1/16/1996 Heikki Tuuri
#include "mach0data.h"
/**********************************************************************
Determines whether the given character set is of variable length.
NOTE: the prototype of this function is copied from ha_innodb.cc! If you change
this function, you MUST change also the prototype here! */
extern
ibool
innobase_is_mb_cset(
/*================*/
ulint cset); /* in: MySQL charset-collation code */
/*************************************************************************
Sets a data type structure. */
UNIV_INLINE
......@@ -293,7 +304,13 @@ dtype_get_fixed_size(
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_MYSQL:
return(dtype_get_len(type));
if ((type->prtype & DATA_BINARY_TYPE)
|| !innobase_is_mb_cset(
dtype_get_charset_coll(
type->prtype))) {
return(dtype_get_len(type));
}
/* fall through for variable-length charsets */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
......
......@@ -473,6 +473,8 @@ row_ins_cascade_calc_update_vec(
if (parent_ufield->field_no == parent_field_no) {
ulint fixed_size;
/* A field in the parent index record is
updated. Let us make the update vector
field for the child table. */
......@@ -512,22 +514,22 @@ row_ins_cascade_calc_update_vec(
need to pad with spaces the new value of the
child column */
if (dtype_is_fixed_size(type)
fixed_size = dtype_get_fixed_size(type);
if (fixed_size
&& ufield->new_val.len != UNIV_SQL_NULL
&& ufield->new_val.len
< dtype_get_fixed_size(type)) {
&& ufield->new_val.len < fixed_size) {
ufield->new_val.data =
mem_heap_alloc(heap,
dtype_get_fixed_size(type));
ufield->new_val.len =
dtype_get_fixed_size(type);
fixed_size);
ufield->new_val.len = fixed_size;
ut_a(dtype_get_pad_char(type)
!= ULINT_UNDEFINED);
memset(ufield->new_val.data,
(byte)dtype_get_pad_char(type),
dtype_get_fixed_size(type));
fixed_size);
ut_memcpy(ufield->new_val.data,
parent_ufield->new_val.data,
parent_ufield->new_val.len);
......
......@@ -3694,6 +3694,8 @@ row_search_for_mysql(
}
if (prebuilt->clust_index_was_generated) {
offsets = rec_reget_offsets(index_rec, index, offsets,
ULINT_UNDEFINED, heap);
row_sel_store_row_id_to_prebuilt(prebuilt, index_rec,
index, offsets);
}
......
......@@ -520,6 +520,25 @@ innobase_mysql_print_thd(
putc('\n', f);
}
/**********************************************************************
Determines whether the given character set is of variable length.
NOTE that the exact prototype of this function has to be in
/innobase/data/data0type.ic! */
extern "C"
ibool
innobase_is_mb_cset(
/*================*/
ulint cset) /* in: MySQL charset-collation code */
{
CHARSET_INFO* cs;
ut_ad(cset < 256);
cs = all_charsets[cset];
return(cs && cs->mbminlen != cs->mbmaxlen);
}
/**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively.
......
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