Commit 6e3a51e0 authored by mmakela's avatar mmakela

branches/innodb+: Merge revisions 6925:6949 from branches/zip:

  ------------------------------------------------------------------------
  r6949 | mmakela | 2010-04-06 16:11:46 +0300 (Tue, 06 Apr 2010) | 7 lines

  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 1e00b610
......@@ -4781,8 +4781,10 @@ UNIV_INTERN
void
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 */
ibool tmp_ok) /*!< in: TRUE=allow temporary
index names */
{
/* Check for duplicates, ignoring indexes that are marked
as to be dropped */
......@@ -4796,9 +4798,11 @@ dict_table_check_for_dup_indexes(
ut_a(UT_LIST_GET_LEN(table->indexes) > 0);
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) {
......@@ -4810,8 +4814,7 @@ dict_table_check_for_dup_indexes(
}
index1 = UT_LIST_GET_NEXT(indexes, index1);
index2 = UT_LIST_GET_NEXT(indexes, index1);
}
} while (index1);
}
#endif /* UNIV_DEBUG */
......
......@@ -722,6 +722,8 @@ err_exit:
row_mysql_lock_data_dictionary(trx);
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
to drop the original table and rebuild all indexes. */
......@@ -754,6 +756,8 @@ err_exit:
user_thd);
}
ut_d(dict_table_check_for_dup_indexes(innodb_table,
FALSE));
row_mysql_unlock_data_dictionary(trx);
goto err_exit;
}
......@@ -828,7 +832,7 @@ error_handling:
row_mysql_lock_data_dictionary(trx);
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) {
error = row_merge_rename_indexes(trx, indexed_table);
......@@ -916,6 +920,8 @@ convert_error:
trx_commit_for_mysql(prebuilt->trx);
}
ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
if (dict_locked) {
row_mysql_unlock_data_dictionary(trx);
}
......@@ -959,6 +965,7 @@ ha_innobase::prepare_drop_index(
/* Test and mark all the indexes to be dropped */
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
for deletion. */
......@@ -1124,6 +1131,7 @@ func_exit:
} while (index);
}
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
row_mysql_unlock_data_dictionary(trx);
DBUG_RETURN(err);
......@@ -1170,6 +1178,7 @@ ha_innobase::final_drop_index(
prebuilt->table->flags, user_thd);
row_mysql_lock_data_dictionary(trx);
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
if (UNIV_UNLIKELY(err)) {
......@@ -1210,9 +1219,8 @@ ha_innobase::final_drop_index(
valid index entry count in the translation table to zero */
share->idx_trans_tbl.index_count = 0;
ut_d(dict_table_check_for_dup_indexes(prebuilt->table));
func_exit:
ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
trx_commit_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx);
row_mysql_unlock_data_dictionary(trx);
......
......@@ -928,9 +928,10 @@ UNIV_INTERN
void
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 */
ibool tmp_ok);/*!< in: TRUE=allow temporary
index names */
#endif /* UNIV_DEBUG */
/**********************************************************************//**
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