diff options
author | Sergei Golubchik <sergii@pisem.net> | 2010-10-19 15:58:35 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2010-10-19 15:58:35 +0200 |
commit | 745cc74c3301f193c7b82c31d11c3bf0c842be9e (patch) | |
tree | 4aa6101c051c91607d2623eed26fb41527fd0bd3 /storage/xtradb/include/dict0dict.ic | |
parent | f0c6576b85a57ec82fd911f73cce7c99683b378c (diff) | |
parent | cc6d22f5356e0969d8d5d1046edc69cb17ea19fb (diff) | |
download | mariadb-git-745cc74c3301f193c7b82c31d11c3bf0c842be9e.tar.gz |
5.1.51 merge
Diffstat (limited to 'storage/xtradb/include/dict0dict.ic')
-rw-r--r-- | storage/xtradb/include/dict0dict.ic | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic index aada3096261..bd7534dc7e2 100644 --- a/storage/xtradb/include/dict0dict.ic +++ b/storage/xtradb/include/dict0dict.ic @@ -452,6 +452,48 @@ dict_table_zip_size( return(dict_table_flags_to_zip_size(table->flags)); } +/*********************************************************************//** +Obtain exclusive locks on all index trees of the table. This is to prevent +accessing index trees while InnoDB is updating internal metadata for +operations such as truncate tables. */ +UNIV_INLINE +void +dict_table_x_lock_indexes( +/*======================*/ + dict_table_t* table) /*!< in: table */ +{ + dict_index_t* index; + + ut_a(table); + ut_ad(mutex_own(&(dict_sys->mutex))); + + /* Loop through each index of the table and lock them */ + for (index = dict_table_get_first_index(table); + index != NULL; + index = dict_table_get_next_index(index)) { + rw_lock_x_lock(dict_index_get_lock(index)); + } +} + +/*********************************************************************//** +Release the exclusive locks on all index tree. */ +UNIV_INLINE +void +dict_table_x_unlock_indexes( +/*========================*/ + dict_table_t* table) /*!< in: table */ +{ + dict_index_t* index; + + ut_a(table); + ut_ad(mutex_own(&(dict_sys->mutex))); + + for (index = dict_table_get_first_index(table); + index != NULL; + index = dict_table_get_next_index(index)) { + rw_lock_x_unlock(dict_index_get_lock(index)); + } +} /********************************************************************//** Gets the number of fields in the internal representation of an index, including fields added by the dictionary system. |