summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-02-07 11:18:21 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-02-07 11:18:21 +0200
commit74ab97f58f2d68b1e860e9a80d51d9948374aa22 (patch)
tree95ae5e7216f745bbc89b9d517dc2d4bba1aee2f9
parent487fbc2e15d98791b1ca966de2d820564973b91c (diff)
downloadmariadb-git-74ab97f58f2d68b1e860e9a80d51d9948374aa22.tar.gz
Cleanup: Remove lock_trx_lock_list_init(), lock_table_get_n_locks()
-rw-r--r--storage/innobase/handler/ha_innodb.cc11
-rw-r--r--storage/innobase/include/lock0lock.h13
-rw-r--r--storage/innobase/lock/lock0lock.cc30
-rw-r--r--storage/innobase/trx/trx0trx.cc3
4 files changed, 7 insertions, 50 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e47b4699893..033c062dc8e 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2692,17 +2692,18 @@ static bool innobase_query_caching_table_check_low(
For read-only transaction: should satisfy (1) and (3)
For read-write transaction: should satisfy (1), (2), (3) */
- if (lock_table_get_n_locks(table)) {
+ if (trx->id && trx->id < table->query_cache_inv_trx_id) {
return false;
}
- if (trx->id && trx->id < table->query_cache_inv_trx_id) {
+ if (trx->read_view.is_open()
+ && trx->read_view.low_limit_id()
+ < table->query_cache_inv_trx_id) {
return false;
}
- return !trx->read_view.is_open()
- || trx->read_view.low_limit_id()
- >= table->query_cache_inv_trx_id;
+ LockMutexGuard g;
+ return UT_LIST_GET_LEN(table->locks) == 0;
}
/** Checks if MySQL at the moment is allowed for this table to retrieve a
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 8b3a5f059b3..10dcde4a50b 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -564,19 +564,6 @@ dberr_t
lock_trx_handle_wait(
/*=================*/
trx_t* trx); /*!< in/out: trx lock state */
-/*********************************************************************//**
-Get the number of locks on a table.
-@return number of locks */
-ulint
-lock_table_get_n_locks(
-/*===================*/
- const dict_table_t* table); /*!< in: table */
-/*******************************************************************//**
-Initialise the trx lock list. */
-void
-lock_trx_lock_list_init(
-/*====================*/
- trx_lock_list_t* lock_list); /*!< List to initialise */
/*********************************************************************//**
Checks that a transaction id is sensible, i.e., not in the future.
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index c44f40a9e6d..c4893c8198c 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -5621,25 +5621,6 @@ lock_trx_handle_wait(
return err;
}
-/*********************************************************************//**
-Get the number of locks on a table.
-@return number of locks */
-ulint
-lock_table_get_n_locks(
-/*===================*/
- const dict_table_t* table) /*!< in: table */
-{
- ulint n_table_locks;
-
- lock_sys.mutex_lock();
-
- n_table_locks = UT_LIST_GET_LEN(table->locks);
-
- lock_sys.mutex_unlock();
-
- return(n_table_locks);
-}
-
#ifdef UNIV_DEBUG
/**
Do an exhaustive check for any locks (table or rec) against the table.
@@ -5719,17 +5700,6 @@ lock_table_lock_list_init(
UT_LIST_INIT(*lock_list, &lock_table_t::locks);
}
-/*******************************************************************//**
-Initialise the trx lock list. */
-void
-lock_trx_lock_list_init(
-/*====================*/
- trx_lock_list_t* lock_list) /*!< List to initialise */
-{
- UT_LIST_INIT(*lock_list, &lock_t::trx_locks);
-}
-
-
#ifdef UNIV_DEBUG
/*******************************************************************//**
Check if the transaction holds any locks on the sys tables
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 77b87c84a20..a05b56365bf 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -186,8 +186,7 @@ struct TrxFactory {
1024, MEM_HEAP_FOR_LOCK_HEAP);
pthread_cond_init(&trx->lock.cond, nullptr);
- lock_trx_lock_list_init(&trx->lock.trx_locks);
-
+ UT_LIST_INIT(trx->lock.trx_locks, &lock_t::trx_locks);
UT_LIST_INIT(trx->lock.evicted_tables,
&dict_table_t::table_LRU);