diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 0aa53b9dd22..8577dcc0274 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -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)) { diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index e48ea76012d..97c1eb4dbf2 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -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));