Commit cf0210a7 authored by marko's avatar marko

branches/zip: Remove an assertion failure when the InnoDB data dictionary

is inconsistent with the MySQL .frm file.

ha_innobase::index_read(): When the index cannot be found,
return an error.

ha_innobase::change_active_index(): When prebuilt->index == NULL,
set also prebuilt->index_usable = FALSE.  This is not needed for
correctness, because prebuilt->index_usable is only checked by
row_search_for_mysql(), which requires prebuilt->index != NULL.

This addresses Issue #349.  Approved by Heikki Tuuri over IM.
parent 6b711d06
2009-09-28 The InnoDB Team
* handler/ha_innodb.cc:
When a secondary index exists in the MySQL .frm file but not in
the InnoDB data dictionary, return an error instead of letting an
assertion fail in index_read.
2009-09-28 The InnoDB Team 2009-09-28 The InnoDB Team
* btr/btr0btr.c, buf/buf0buf.c, * btr/btr0btr.c, buf/buf0buf.c,
......
...@@ -5060,6 +5060,11 @@ ha_innobase::index_read( ...@@ -5060,6 +5060,11 @@ ha_innobase::index_read(
index = prebuilt->index; index = prebuilt->index;
if (UNIV_UNLIKELY(index == NULL)) {
prebuilt->index_usable = FALSE;
DBUG_RETURN(HA_ERR_CRASHED);
}
/* Note that if the index for which the search template is built is not /* Note that if the index for which the search template is built is not
necessarily prebuilt->index, but can also be the clustered index */ necessarily prebuilt->index, but can also be the clustered index */
...@@ -5219,6 +5224,7 @@ ha_innobase::change_active_index( ...@@ -5219,6 +5224,7 @@ ha_innobase::change_active_index(
if (UNIV_UNLIKELY(!prebuilt->index)) { if (UNIV_UNLIKELY(!prebuilt->index)) {
sql_print_warning("InnoDB: change_active_index(%u) failed", sql_print_warning("InnoDB: change_active_index(%u) failed",
keynr); keynr);
prebuilt->index_usable = FALSE;
DBUG_RETURN(1); DBUG_RETURN(1);
} }
......
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