Commit 72d60207 authored by mmakela's avatar mmakela

branches/zip: Add debug checks to track down Issue #461.

dict_table_check_for_dup_indexes(): Add the flag tmp_ok.  If !tmp_ok,
check that no index name starts with TEMP_INDEX_PREFIX.

ha_innobase::add_index(), ha_innobase::prepare_drop_index(),
ha_innobase::final_drop_index(): Call dict_table_check_for_dup_indexes().
parent 0e472197
...@@ -4767,8 +4767,10 @@ UNIV_INTERN ...@@ -4767,8 +4767,10 @@ UNIV_INTERN
void void
dict_table_check_for_dup_indexes( dict_table_check_for_dup_indexes(
/*=============================*/ /*=============================*/
const dict_table_t* table) /*!< in: Check for dup indexes const dict_table_t* table, /*!< in: Check for dup indexes
in this table */ in this table */
ibool tmp_ok) /*!< in: TRUE=allow temporary
index names */
{ {
/* Check for duplicates, ignoring indexes that are marked /* Check for duplicates, ignoring indexes that are marked
as to be dropped */ as to be dropped */
...@@ -4782,9 +4784,11 @@ dict_table_check_for_dup_indexes( ...@@ -4782,9 +4784,11 @@ dict_table_check_for_dup_indexes(
ut_a(UT_LIST_GET_LEN(table->indexes) > 0); ut_a(UT_LIST_GET_LEN(table->indexes) > 0);
index1 = UT_LIST_GET_FIRST(table->indexes); index1 = UT_LIST_GET_FIRST(table->indexes);
index2 = UT_LIST_GET_NEXT(indexes, index1);
while (index1 && index2) { do {
ut_ad(tmp_ok || *index1->name != TEMP_INDEX_PREFIX);
index2 = UT_LIST_GET_NEXT(indexes, index1);
while (index2) { while (index2) {
...@@ -4796,8 +4800,7 @@ dict_table_check_for_dup_indexes( ...@@ -4796,8 +4800,7 @@ dict_table_check_for_dup_indexes(
} }
index1 = UT_LIST_GET_NEXT(indexes, index1); index1 = UT_LIST_GET_NEXT(indexes, index1);
index2 = UT_LIST_GET_NEXT(indexes, index1); } while (index1);
}
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
......
...@@ -722,6 +722,8 @@ err_exit: ...@@ -722,6 +722,8 @@ err_exit:
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE; dict_locked = TRUE;
ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
/* If a new primary key is defined for the table we need /* If a new primary key is defined for the table we need
to drop the original table and rebuild all indexes. */ to drop the original table and rebuild all indexes. */
...@@ -754,6 +756,8 @@ err_exit: ...@@ -754,6 +756,8 @@ err_exit:
user_thd); user_thd);
} }
ut_d(dict_table_check_for_dup_indexes(innodb_table,
FALSE));
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
goto err_exit; goto err_exit;
} }
...@@ -828,7 +832,7 @@ error_handling: ...@@ -828,7 +832,7 @@ error_handling:
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE; dict_locked = TRUE;
ut_d(dict_table_check_for_dup_indexes(prebuilt->table)); ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
if (!new_primary) { if (!new_primary) {
error = row_merge_rename_indexes(trx, indexed_table); error = row_merge_rename_indexes(trx, indexed_table);
...@@ -916,6 +920,8 @@ convert_error: ...@@ -916,6 +920,8 @@ convert_error:
trx_commit_for_mysql(prebuilt->trx); trx_commit_for_mysql(prebuilt->trx);
} }
ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
if (dict_locked) { if (dict_locked) {
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
...@@ -959,6 +965,7 @@ ha_innobase::prepare_drop_index( ...@@ -959,6 +965,7 @@ ha_innobase::prepare_drop_index(
/* Test and mark all the indexes to be dropped */ /* Test and mark all the indexes to be dropped */
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
/* Check that none of the indexes have previously been flagged /* Check that none of the indexes have previously been flagged
for deletion. */ for deletion. */
...@@ -1124,6 +1131,7 @@ func_exit: ...@@ -1124,6 +1131,7 @@ func_exit:
} while (index); } while (index);
} }
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
DBUG_RETURN(err); DBUG_RETURN(err);
...@@ -1170,6 +1178,7 @@ ha_innobase::final_drop_index( ...@@ -1170,6 +1178,7 @@ ha_innobase::final_drop_index(
prebuilt->table->flags, user_thd); prebuilt->table->flags, user_thd);
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
if (UNIV_UNLIKELY(err)) { if (UNIV_UNLIKELY(err)) {
...@@ -1210,9 +1219,8 @@ ha_innobase::final_drop_index( ...@@ -1210,9 +1219,8 @@ ha_innobase::final_drop_index(
valid index entry count in the translation table to zero */ valid index entry count in the translation table to zero */
share->idx_trans_tbl.index_count = 0; share->idx_trans_tbl.index_count = 0;
ut_d(dict_table_check_for_dup_indexes(prebuilt->table));
func_exit: func_exit:
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx); trx_commit_for_mysql(prebuilt->trx);
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
......
...@@ -928,9 +928,10 @@ UNIV_INTERN ...@@ -928,9 +928,10 @@ UNIV_INTERN
void void
dict_table_check_for_dup_indexes( dict_table_check_for_dup_indexes(
/*=============================*/ /*=============================*/
const dict_table_t* table); /*!< in: Check for dup indexes const dict_table_t* table, /*!< in: Check for dup indexes
in this table */ in this table */
ibool tmp_ok);/*!< in: TRUE=allow temporary
index names */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/**********************************************************************//** /**********************************************************************//**
Builds a node pointer out of a physical record and a page number. Builds a node pointer out of a physical record and a page number.
......
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