summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2019-06-22 13:46:46 +0300
committerEugene Kosov <claprix@yandex.ru>2019-06-26 13:12:29 +0300
commitadb640e25ad3a415e5a744e84d5d4ce675c82daa (patch)
treed05eae74c37a92be299dede1e4c78579a705c95e /storage
parent52a5097764a35a6cd1d185958afeef443901577a (diff)
downloadmariadb-git-adb640e25ad3a415e5a744e84d5d4ce675c82daa.tar.gz
MDEV-17441 InnoDB transition to C++11 atomics
zip_pad_info_t::mutex_created: remove along with corresponding stuff zip_pad_info_t::mutex: make member value instead of a pointer
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/dict/dict0dict.cc35
-rw-r--r--storage/innobase/dict/dict0mem.cc4
-rw-r--r--storage/innobase/include/dict0mem.h44
-rw-r--r--storage/innobase/page/page0zip.cc2
4 files changed, 8 insertions, 77 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 5edede7c20f..f36427db0e4 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -568,33 +568,6 @@ dict_table_get_nth_v_col_mysql(
return(dict_table_get_nth_v_col(table, i));
}
-/** 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 */
-static
-void
-dict_index_zip_pad_alloc(
- void* index_void)
-{
- dict_index_t* index = static_cast<dict_index_t*>(index_void);
- index->zip_pad.mutex = UT_NEW_NOKEY(SysMutex());
- ut_a(index->zip_pad.mutex != NULL);
- mutex_create(LATCH_ID_ZIP_PAD_MUTEX, index->zip_pad.mutex);
-}
-
-/** Acquire the zip_pad_mutex latch.
-@param[in,out] index the index whose zip_pad_mutex to acquire.*/
-static
-void
-dict_index_zip_pad_lock(
- dict_index_t* index)
-{
- os_once::do_or_wait_for_done(
- &index->zip_pad.mutex_created,
- dict_index_zip_pad_alloc, index);
-
- mutex_enter(index->zip_pad.mutex);
-}
/** Get all the FTS indexes on a table.
@param[in] table table
@@ -6453,10 +6426,10 @@ dict_index_zip_success(
return;
}
- dict_index_zip_pad_lock(index);
+ mutex_enter(&index->zip_pad.mutex);
++index->zip_pad.success;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- dict_index_zip_pad_unlock(index);
+ mutex_exit(&index->zip_pad.mutex);
}
/*********************************************************************//**
@@ -6473,10 +6446,10 @@ dict_index_zip_failure(
return;
}
- dict_index_zip_pad_lock(index);
+ mutex_enter(&index->zip_pad.mutex);
++index->zip_pad.failure;
dict_index_zip_pad_update(&index->zip_pad, zip_threshold);
- dict_index_zip_pad_unlock(index);
+ mutex_exit(&index->zip_pad.mutex);
}
/*********************************************************************//**
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 56df3dfc7a6..9e67f19e8b3 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -740,7 +740,7 @@ dict_mem_index_create(
dict_mem_fill_index_struct(index, heap, index_name, type, n_fields);
- dict_index_zip_pad_mutex_create_lazy(index);
+ mutex_create(LATCH_ID_ZIP_PAD_MUTEX, &index->zip_pad.mutex);
if (type & DICT_SPATIAL) {
mutex_create(LATCH_ID_RTR_SSN_MUTEX, &index->rtr_ssn.mutex);
@@ -1050,7 +1050,7 @@ dict_mem_index_free(
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- dict_index_zip_pad_mutex_destroy(index);
+ mutex_free(&index->zip_pad.mutex);
if (dict_index_is_spatial(index)) {
for (auto& rtr_info : index->rtr_track->rtr_active) {
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index fddb72c8c88..a6ea8d17e03 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -883,7 +883,7 @@ extern ulong zip_pad_max;
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 {
- SysMutex* mutex; /*!< mutex protecting the info */
+ SysMutex mutex; /*!< mutex protecting the info */
Atomic_counter<ulint>
pad; /*!< number of bytes used as pad */
ulint success;/*!< successful compression ops during
@@ -892,9 +892,6 @@ 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 */
};
/** Number of samples of data size kept when page compression fails for
@@ -2286,45 +2283,6 @@ struct dict_foreign_add_to_referenced_table {
}
};
-/** 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)
-{
- index->zip_pad.mutex = NULL;
- index->zip_pad.mutex_created = os_once::NEVER_DONE;
-}
-
-/** 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) {
- mutex_free(index->zip_pad.mutex);
- UT_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)
-{
- mutex_exit(index->zip_pad.mutex);
-}
-
/** Check whether the col is used in spatial index or regular index.
@param[in] col column to check
@return spatial status */
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 6ad7cdcfa06..c1bb2f2c37d 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -1602,7 +1602,7 @@ page_zip_fields_free(
{
if (index) {
dict_table_t* table = index->table;
- dict_index_zip_pad_mutex_destroy(index);
+ mutex_free(&index->zip_pad.mutex);
mem_heap_free(index->heap);
dict_mem_table_free(table);