Commit 74ab97f5 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove lock_trx_lock_list_init(), lock_table_get_n_locks()

parent 487fbc2e
......@@ -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
......
......@@ -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.
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment