Commit 55129f67 authored by Marko Mäkelä's avatar Marko Mäkelä

Bug#17312846 CHECK TABLE ASSERTION FAILURE

DICT_TABLE_GET_FORMAT(CLUST_INDEX->TABLE) >= 1

The function row_sel_sec_rec_is_for_clust_rec() was incorrectly
preparing to compare a NULL column prefix in a secondary index with a
non-NULL column in a clustered index.

This can trigger an assertion failure in 5.1 plugin and later. In the
built-in InnoDB of MySQL 5.1 and earlier, we would apparently only do
some extra work, by trimming the clustered index field for the
comparison.

The code might actually have worked properly apart from this debug
assertion failure. It is merely doing some extra work in fetching a
BLOB column, and then comparing it to NULL (which would return the
same result, no matter what the BLOB contents is).

While the test case involves CHECK TABLE, this could theoretically
occur during any read that uses a secondary index on a column prefix
of a column that can be NULL.

rb#3101 approved by Mattias Jonsson
parent 5163c4a1
...@@ -107,7 +107,8 @@ row_sel_sec_rec_is_for_clust_rec( ...@@ -107,7 +107,8 @@ row_sel_sec_rec_is_for_clust_rec(
dict_col_get_clust_pos(col, clust_index), &clust_len); dict_col_get_clust_pos(col, clust_index), &clust_len);
sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len); sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
if (ifield->prefix_len > 0 && clust_len != UNIV_SQL_NULL) { if (ifield->prefix_len > 0 && clust_len != UNIV_SQL_NULL
&& sec_len != UNIV_SQL_NULL) {
clust_len = dtype_get_at_most_n_mbchars( clust_len = dtype_get_at_most_n_mbchars(
col->prtype, col->mbminlen, col->mbmaxlen, col->prtype, col->mbminlen, col->mbmaxlen,
......
2013-08-16 The InnoDB Team
* row/row0sel.c:
Fix Bug#17312846 CHECK TABLE ASSERTION FAILURE
DICT_TABLE_GET_FORMAT(CLUST_INDEX->TABLE) >= 1
2013-08-15 The InnoDB Team 2013-08-15 The InnoDB Team
* row/row0umod.c: * row/row0umod.c:
......
...@@ -219,7 +219,8 @@ row_sel_sec_rec_is_for_clust_rec( ...@@ -219,7 +219,8 @@ row_sel_sec_rec_is_for_clust_rec(
len = clust_len; len = clust_len;
if (ifield->prefix_len > 0 && len != UNIV_SQL_NULL) { if (ifield->prefix_len > 0 && len != UNIV_SQL_NULL
&& sec_len != UNIV_SQL_NULL) {
if (rec_offs_nth_extern(clust_offs, clust_pos)) { if (rec_offs_nth_extern(clust_offs, clust_pos)) {
len -= BTR_EXTERN_FIELD_REF_SIZE; len -= BTR_EXTERN_FIELD_REF_SIZE;
......
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