Commit 52a7c919 authored by Jimmy Yang's avatar Jimmy Yang

Fix an assertion failure with UNIV_DEBUG is set. Initialize a

dict_index_t structure to NULL in dict_load_index(), we could
enter SYS_INDEXES and got table id value comparision failure
for system tables such as SYS_TABLES. In addition, remove
dict_sys mutex assertion when fill I_S table, as we no longer
hold mutex accross the fill operation.

rb://367 approved by Marko.
parent 60d42882
......@@ -1168,6 +1168,10 @@ static const char* dict_load_index_id_err = "SYS_INDEXES.TABLE_ID mismatch";
/********************************************************************//**
Loads an index definition from a SYS_INDEXES record to dict_index_t.
If "cached" is set to "TRUE", we will create a dict_index_t structure
and fill it accordingly. Otherwise, the dict_index_t will
be supplied by the caller and filled with information read from
the record.
@return error message, or NULL on success */
UNIV_INTERN
const char*
......@@ -1192,6 +1196,12 @@ dict_load_index_low(
ulint type;
ulint space;
if (cached) {
/* If "cached" is set to TRUE, no dict_index_t will
be supplied. Initialize "*index" to NULL */
*index = NULL;
}
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return(dict_load_index_del);
}
......@@ -1331,7 +1341,7 @@ dict_load_indexes(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr);
for (;;) {
dict_index_t* index;
dict_index_t* index = NULL;
const char* err_msg;
if (!btr_pcur_is_on_user_rec(&pcur)) {
......
......@@ -1978,8 +1978,6 @@ i_s_dict_fill_sys_tables(
DBUG_ENTER("i_s_dict_fill_sys_tables");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
table_id = ut_conv_dulint_to_longlong(table->id);
......@@ -2245,8 +2243,6 @@ i_s_dict_fill_sys_tablestats(
DBUG_ENTER("i_s_dict_fill_sys_tablestats");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
table_id = ut_conv_dulint_to_longlong(table->id);
......@@ -2510,8 +2506,6 @@ i_s_dict_fill_sys_indexes(
DBUG_ENTER("i_s_dict_fill_sys_indexes");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
table_id = ut_conv_dulint_to_longlong(tableid);
......@@ -2754,8 +2748,6 @@ i_s_dict_fill_sys_columns(
DBUG_ENTER("i_s_dict_fill_sys_columns");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
table_id = ut_conv_dulint_to_longlong(tableid);
......@@ -2966,8 +2958,6 @@ i_s_dict_fill_sys_fields(
DBUG_ENTER("i_s_dict_fill_sys_fields");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
index_id = ut_conv_dulint_to_longlong(indexid);
......@@ -3194,8 +3184,6 @@ i_s_dict_fill_sys_foreign(
DBUG_ENTER("i_s_dict_fill_sys_foreign");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
OK(field_store_string(fields[SYS_FOREIGN_ID], foreign->id));
......@@ -3411,8 +3399,6 @@ i_s_dict_fill_sys_foreign_cols(
DBUG_ENTER("i_s_dict_fill_sys_foreign_cols");
ut_ad(mutex_own(&(dict_sys->mutex)));
fields = table_to_fill->field;
OK(field_store_string(fields[SYS_FOREIGN_COL_ID], name));
......
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