diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-05-05 00:06:23 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-05-05 00:06:23 +0200 |
commit | 70a3fec4008dffa68493996e83e56c7786fd0bdf (patch) | |
tree | d2a9feae1a89298a1a15ccb865b1d77f4de04c9f /storage/innobase/include | |
parent | 0b4f5060bbdccea4d9a3c04437aa7e97fbfc1b30 (diff) | |
parent | 085297a1214814cd7eacbab2afb24c7a08bfc40e (diff) | |
download | mariadb-git-70a3fec4008dffa68493996e83e56c7786fd0bdf.tar.gz |
InnoDB-5.6.24
Diffstat (limited to 'storage/innobase/include')
-rw-r--r-- | storage/innobase/include/dict0mem.h | 122 | ||||
-rw-r--r-- | storage/innobase/include/univ.i | 2 |
2 files changed, 119 insertions, 5 deletions
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index be0ef395ba8..3d5d7b8e6e8 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -548,11 +548,12 @@ extern ulong zip_failure_threshold_pct; compression failures */ extern ulong zip_pad_max; -/** Data structure to hold information about about how much space in +/** Data structure to hold information about how much space in an uncompressed page should be left as padding to avoid compression failures. This estimate is based on a self-adapting heuristic. */ struct zip_pad_info_t { - os_fast_mutex_t mutex; /*!< mutex protecting the info */ + os_fast_mutex_t* + mutex; /*!< mutex protecting the info */ ulint pad; /*!< number of bytes used as pad */ ulint success;/*!< successful compression ops during current round */ @@ -560,6 +561,9 @@ struct zip_pad_info_t { current round */ ulint n_rounds;/*!< number of currently successful rounds */ + volatile os_once::state_t + mutex_created; + /*!< Creation state of mutex member */ }; /** Data structure for an index. Most fields will be @@ -1160,9 +1164,14 @@ struct dict_table_t{ space from the lock heap of the trx: otherwise the lock heap would grow rapidly if we do a large insert from a select */ - ib_mutex_t autoinc_mutex; + ib_mutex_t* autoinc_mutex; /*!< mutex protecting the autoincrement counter */ + + /** Creation state of autoinc_mutex member */ + volatile os_once::state_t + autoinc_mutex_created; + ib_uint64_t autoinc;/*!< autoinc counter value to give to the next inserted row */ ulong n_waiting_or_granted_auto_inc_locks; @@ -1225,6 +1234,111 @@ struct dict_foreign_add_to_referenced_table { } }; +/** Destroy the autoinc latch of the given table. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] table table whose stats latch to destroy */ +inline +void +dict_table_autoinc_destroy( + dict_table_t* table) +{ + if (table->autoinc_mutex_created == os_once::DONE + && table->autoinc_mutex != NULL) { + mutex_free(table->autoinc_mutex); + delete table->autoinc_mutex; + } +} + +/** Allocate and init the autoinc latch of a given table. +This function must not be called concurrently on the same table object. +@param[in,out] table_void table whose autoinc latch to create */ +void +dict_table_autoinc_alloc( + void* table_void); + +/** Allocate and init the zip_pad_mutex of a given index. +This function must not be called concurrently on the same index object. +@param[in,out] index_void index whose zip_pad_mutex to create */ +void +dict_index_zip_pad_alloc( + void* index_void); + +/** Request for lazy creation of the autoinc latch of a given table. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] table table whose autoinc latch is to be created. */ +inline +void +dict_table_autoinc_create_lazy( + dict_table_t* table) +{ +#ifdef HAVE_ATOMIC_BUILTINS + table->autoinc_mutex = NULL; + table->autoinc_mutex_created = os_once::NEVER_DONE; +#else /* HAVE_ATOMIC_BUILTINS */ + dict_table_autoinc_alloc(table); + table->autoinc_mutex_created = os_once::DONE; +#endif /* HAVE_ATOMIC_BUILTINS */ +} + +/** Request a lazy creation of dict_index_t::zip_pad::mutex. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] index index whose zip_pad mutex is to be created */ +inline +void +dict_index_zip_pad_mutex_create_lazy( + dict_index_t* index) +{ +#ifdef HAVE_ATOMIC_BUILTINS + index->zip_pad.mutex = NULL; + index->zip_pad.mutex_created = os_once::NEVER_DONE; +#else /* HAVE_ATOMIC_BUILTINS */ + dict_index_zip_pad_alloc(index); + index->zip_pad.mutex_created = os_once::DONE; +#endif /* HAVE_ATOMIC_BUILTINS */ +} + +/** Destroy the zip_pad_mutex of the given index. +This function is only called from either single threaded environment +or from a thread that has not shared the table object with other threads. +@param[in,out] table table whose stats latch to destroy */ +inline +void +dict_index_zip_pad_mutex_destroy( + dict_index_t* index) +{ + if (index->zip_pad.mutex_created == os_once::DONE + && index->zip_pad.mutex != NULL) { + os_fast_mutex_free(index->zip_pad.mutex); + delete index->zip_pad.mutex; + } +} + +/** Release the zip_pad_mutex of a given index. +@param[in,out] index index whose zip_pad_mutex is to be released */ +inline +void +dict_index_zip_pad_unlock( + dict_index_t* index) +{ + os_fast_mutex_unlock(index->zip_pad.mutex); +} + +#ifdef UNIV_DEBUG +/** Check if the current thread owns the autoinc_mutex of a given table. +@param[in] table the autoinc_mutex belongs to this table +@return true, if the current thread owns the autoinc_mutex, false otherwise.*/ +inline +bool +dict_table_autoinc_own( + const dict_table_t* table) +{ + return(mutex_own(table->autoinc_mutex)); +} +#endif /* UNIV_DEBUG */ + #ifndef UNIV_NONINL #include "dict0mem.ic" #endif diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 3c96c93cfa5..48d58012de6 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -44,7 +44,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 23 +#define INNODB_VERSION_BUGFIX 24 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; |