diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-14 10:10:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-04-14 10:10:44 +0300 |
commit | 8074ab57843234198a711dda101d2b2690c41df5 (patch) | |
tree | 68791c96a0556d1f768e943b1c88cbe17d741811 /storage/innobase/trx | |
parent | 0cd2e6c61478baf91235a66f0357974a26f02ece (diff) | |
download | mariadb-git-8074ab57843234198a711dda101d2b2690c41df5.tar.gz |
MDEV-28313: Shrink rw_trx_hash_element_t::mutex
The element mutex is unnecessarily large. The PERFORMANCE_SCHEMA
instrumentation was not even enabled.
Diffstat (limited to 'storage/innobase/trx')
-rw-r--r-- | storage/innobase/trx/trx0roll.cc | 10 | ||||
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 8fd9f93909c..ddad699ead4 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2021, MariaDB Corporation. +Copyright (c) 2016, 2022, MariaDB Corporation. 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 @@ -631,7 +631,7 @@ struct trx_roll_count_callback_arg static my_bool trx_roll_count_callback(rw_trx_hash_element_t *element, trx_roll_count_callback_arg *arg) { - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (trx_t *trx= element->trx) { if (trx->is_recovered && trx_state_eq(trx, TRX_STATE_ACTIVE)) @@ -640,7 +640,7 @@ static my_bool trx_roll_count_callback(rw_trx_hash_element_t *element, arg->n_rows+= trx->undo_no; } } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return 0; } @@ -678,7 +678,7 @@ void trx_roll_report_progress() static my_bool trx_rollback_recovered_callback(rw_trx_hash_element_t *element, std::vector<trx_t*> *trx_list) { - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (trx_t *trx= element->trx) { trx->mutex_lock(); @@ -686,7 +686,7 @@ static my_bool trx_rollback_recovered_callback(rw_trx_hash_element_t *element, trx_list->push_back(trx); trx->mutex_unlock(); } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return 0; } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 7b070a605f4..3c3c4db2b3e 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2021, MariaDB Corporation. +Copyright (c) 2015, 2022, MariaDB Corporation. 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 @@ -1914,7 +1914,7 @@ static my_bool trx_recover_for_mysql_callback(rw_trx_hash_element_t *element, trx_recover_for_mysql_callback_arg *arg) { DBUG_ASSERT(arg->len > 0); - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (trx_t *trx= element->trx) { /* @@ -1940,7 +1940,7 @@ static my_bool trx_recover_for_mysql_callback(rw_trx_hash_element_t *element, } } } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); /* Do not terminate upon reaching arg->len; count all transactions */ return false; } @@ -1949,13 +1949,13 @@ static my_bool trx_recover_for_mysql_callback(rw_trx_hash_element_t *element, static my_bool trx_recover_reset_callback(rw_trx_hash_element_t *element, void*) { - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (trx_t *trx= element->trx) { if (trx_state_eq(trx, TRX_STATE_PREPARED_RECOVERED)) trx->state= TRX_STATE_PREPARED; } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return false; } @@ -2004,7 +2004,7 @@ static my_bool trx_get_trx_by_xid_callback(rw_trx_hash_element_t *element, trx_get_trx_by_xid_callback_arg *arg) { my_bool found= 0; - mysql_mutex_lock(&element->mutex); + element->mutex.wr_lock(); if (trx_t *trx= element->trx) { trx->mutex_lock(); @@ -2026,7 +2026,7 @@ static my_bool trx_get_trx_by_xid_callback(rw_trx_hash_element_t *element, } trx->mutex_unlock(); } - mysql_mutex_unlock(&element->mutex); + element->mutex.wr_unlock(); return found; } |