summaryrefslogtreecommitdiff
path: root/storage/innobase/dict
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-18 14:49:44 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-18 15:02:55 +0300
commit386f168ab340791631e4d8979c4370ecef7e6b05 (patch)
tree6dd67b95b02ef42b7d76b138f31554a7cc433a9e /storage/innobase/dict
parentfde94b4cd6c916f118ccb2785c09dafef391298c (diff)
downloadmariadb-git-386f168ab340791631e4d8979c4370ecef7e6b05.tar.gz
MDEV-22456 after-merge fix: introduce Atomic_relaxed
In the merge 9e6e43551fc61bc34152f8d60f5d72f0d3814787 we made Atomic_counter a more generic wrapper of std::atomic so that dict_index_t would support the implicit assignment operator. It is better to revert the changes to Atomic_counter and instead introduce Atomic_relaxed as a generic wrapper to std::atomic. Unlike Atomic_counter, we will not define operator++, operator+= or similar, because we want to make the operations more explicit in the users of Atomic_wrapper, because unlike loads and stores, atomic read-modify-write operations always incur some overhead.
Diffstat (limited to 'storage/innobase/dict')
-rw-r--r--storage/innobase/dict/dict0dict.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index c9abc03f682..e04d1dcbbe0 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -6158,10 +6158,7 @@ dict_index_zip_pad_update(
beyond max pad size. */
if (info->pad + ZIP_PAD_INCR
< (srv_page_size * zip_pad_max) / 100) {
- /* Use atomics even though we have the mutex.
- This is to ensure that we are able to read
- info->pad atomically. */
- info->pad += ZIP_PAD_INCR;
+ info->pad.fetch_add(ZIP_PAD_INCR);
MONITOR_INC(MONITOR_PAD_INCREMENTS);
}
@@ -6178,11 +6175,7 @@ dict_index_zip_pad_update(
padding. */
if (info->n_rounds >= ZIP_PAD_SUCCESSFUL_ROUND_LIMIT
&& info->pad > 0) {
-
- /* Use atomics even though we have the mutex.
- This is to ensure that we are able to read
- info->pad atomically. */
- info->pad -= ZIP_PAD_INCR;
+ info->pad.fetch_sub(ZIP_PAD_INCR);
info->n_rounds = 0;