diff options
Diffstat (limited to 'storage/innobase/dict/dict0dict.c')
-rw-r--r-- | storage/innobase/dict/dict0dict.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 2e524a5a2e3..a58ca2e7802 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -70,6 +70,17 @@ we need this; NOTE: a transaction which reserves this must keep book on the mode in trx_struct::dict_operation_lock_mode */ UNIV_INTERN rw_lock_t dict_operation_lock; +/* Keys to register rwlocks and mutexes with performance schema */ +#ifdef UNIV_PFS_RWLOCK +UNIV_INTERN mysql_pfs_key_t dict_operation_lock_key; +UNIV_INTERN mysql_pfs_key_t index_tree_rw_lock_key; +#endif /* UNIV_PFS_RWLOCK */ + +#ifdef UNIV_PFS_MUTEX +UNIV_INTERN mysql_pfs_key_t dict_sys_mutex_key; +UNIV_INTERN mysql_pfs_key_t dict_foreign_err_mutex_key; +#endif /* UNIV_PFS_MUTEX */ + #define DICT_HEAP_SIZE 100 /*!< initial memory heap size when creating a table or index object */ #define DICT_POOL_PER_TABLE_HASH 512 /*!< buffer pool max size per table @@ -140,7 +151,7 @@ static void dict_field_print_low( /*=================*/ - dict_field_t* field); /*!< in: field */ + const dict_field_t* field); /*!< in: field */ /*********************************************************************//** Frees a foreign key struct. */ static @@ -607,7 +618,7 @@ dict_init(void) { dict_sys = mem_alloc(sizeof(dict_sys_t)); - mutex_create(&dict_sys->mutex, SYNC_DICT); + mutex_create(dict_sys_mutex_key, &dict_sys->mutex, SYNC_DICT); dict_sys->table_hash = hash_create(buf_pool_get_curr_size() / (DICT_POOL_PER_TABLE_HASH @@ -619,12 +630,14 @@ dict_init(void) UT_LIST_INIT(dict_sys->table_LRU); - rw_lock_create(&dict_operation_lock, SYNC_DICT_OPERATION); + rw_lock_create(dict_operation_lock_key, + &dict_operation_lock, SYNC_DICT_OPERATION); dict_foreign_err_file = os_file_create_tmpfile(); ut_a(dict_foreign_err_file); - mutex_create(&dict_foreign_err_mutex, SYNC_ANY_LATCH); + mutex_create(dict_foreign_err_mutex_key, + &dict_foreign_err_mutex, SYNC_ANY_LATCH); } /**********************************************************************//** @@ -1460,6 +1473,7 @@ dict_index_add_to_cache( if (!dict_index_find_cols(table, index)) { + dict_mem_index_free(index); return(DB_CORRUPTION); } @@ -1566,7 +1580,8 @@ undo_size_ok: new_index->stat_n_leaf_pages = 1; new_index->page = page_no; - rw_lock_create(&new_index->lock, SYNC_INDEX_TREE); + rw_lock_create(index_tree_rw_lock_key, &new_index->lock, + SYNC_INDEX_TREE); if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) { @@ -4402,7 +4417,7 @@ static void dict_field_print_low( /*=================*/ - dict_field_t* field) /*!< in: field */ + const dict_field_t* field) /*!< in: field */ { ut_ad(mutex_own(&(dict_sys->mutex))); @@ -4766,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 */ @@ -4775,13 +4792,17 @@ dict_table_check_for_dup_indexes( const dict_index_t* index1; const dict_index_t* index2; + ut_ad(mutex_own(&dict_sys->mutex)); + /* The primary index _must_ exist */ 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) { @@ -4793,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 */ |