Skip to content

Commit

Permalink
Cleanup: Remove lock_trx_lock_list_init(), lock_table_get_n_locks()
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Feb 7, 2021
1 parent 487fbc2 commit 74ab97f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 50 deletions.
11 changes: 6 additions & 5 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions storage/innobase/include/lock0lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
30 changes: 0 additions & 30 deletions storage/innobase/lock/lock0lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/trx/trx0trx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 74ab97f

Please sign in to comment.