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
This commit is contained in:
Marko Mäkelä 2013-08-16 15:45:41 +03:00
parent 318096074e
commit fb2a2d2562
3 changed files with 10 additions and 2 deletions

View File

@ -107,7 +107,8 @@ row_sel_sec_rec_is_for_clust_rec(
dict_col_get_clust_pos(col, clust_index), &clust_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(
col->prtype, col->mbminlen, col->mbmaxlen,

View File

@ -1,3 +1,9 @@
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
* row/row0umod.c:

View File

@ -219,7 +219,8 @@ row_sel_sec_rec_is_for_clust_rec(
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)) {
len -= BTR_EXTERN_FIELD_REF_SIZE;