Skip to content

Commit 74ab97f

Browse files
committed
Cleanup: Remove lock_trx_lock_list_init(), lock_table_get_n_locks()
1 parent 487fbc2 commit 74ab97f

File tree

4 files changed

+7
-50
lines changed

4 files changed

+7
-50
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,17 +2692,18 @@ static bool innobase_query_caching_table_check_low(
26922692
For read-only transaction: should satisfy (1) and (3)
26932693
For read-write transaction: should satisfy (1), (2), (3) */
26942694

2695-
if (lock_table_get_n_locks(table)) {
2695+
if (trx->id && trx->id < table->query_cache_inv_trx_id) {
26962696
return false;
26972697
}
26982698

2699-
if (trx->id && trx->id < table->query_cache_inv_trx_id) {
2699+
if (trx->read_view.is_open()
2700+
&& trx->read_view.low_limit_id()
2701+
< table->query_cache_inv_trx_id) {
27002702
return false;
27012703
}
27022704

2703-
return !trx->read_view.is_open()
2704-
|| trx->read_view.low_limit_id()
2705-
>= table->query_cache_inv_trx_id;
2705+
LockMutexGuard g;
2706+
return UT_LIST_GET_LEN(table->locks) == 0;
27062707
}
27072708

27082709
/** Checks if MySQL at the moment is allowed for this table to retrieve a

storage/innobase/include/lock0lock.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -564,19 +564,6 @@ dberr_t
564564
lock_trx_handle_wait(
565565
/*=================*/
566566
trx_t* trx); /*!< in/out: trx lock state */
567-
/*********************************************************************//**
568-
Get the number of locks on a table.
569-
@return number of locks */
570-
ulint
571-
lock_table_get_n_locks(
572-
/*===================*/
573-
const dict_table_t* table); /*!< in: table */
574-
/*******************************************************************//**
575-
Initialise the trx lock list. */
576-
void
577-
lock_trx_lock_list_init(
578-
/*====================*/
579-
trx_lock_list_t* lock_list); /*!< List to initialise */
580567

581568
/*********************************************************************//**
582569
Checks that a transaction id is sensible, i.e., not in the future.

storage/innobase/lock/lock0lock.cc

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5621,25 +5621,6 @@ lock_trx_handle_wait(
56215621
return err;
56225622
}
56235623

5624-
/*********************************************************************//**
5625-
Get the number of locks on a table.
5626-
@return number of locks */
5627-
ulint
5628-
lock_table_get_n_locks(
5629-
/*===================*/
5630-
const dict_table_t* table) /*!< in: table */
5631-
{
5632-
ulint n_table_locks;
5633-
5634-
lock_sys.mutex_lock();
5635-
5636-
n_table_locks = UT_LIST_GET_LEN(table->locks);
5637-
5638-
lock_sys.mutex_unlock();
5639-
5640-
return(n_table_locks);
5641-
}
5642-
56435624
#ifdef UNIV_DEBUG
56445625
/**
56455626
Do an exhaustive check for any locks (table or rec) against the table.
@@ -5719,17 +5700,6 @@ lock_table_lock_list_init(
57195700
UT_LIST_INIT(*lock_list, &lock_table_t::locks);
57205701
}
57215702

5722-
/*******************************************************************//**
5723-
Initialise the trx lock list. */
5724-
void
5725-
lock_trx_lock_list_init(
5726-
/*====================*/
5727-
trx_lock_list_t* lock_list) /*!< List to initialise */
5728-
{
5729-
UT_LIST_INIT(*lock_list, &lock_t::trx_locks);
5730-
}
5731-
5732-
57335703
#ifdef UNIV_DEBUG
57345704
/*******************************************************************//**
57355705
Check if the transaction holds any locks on the sys tables

storage/innobase/trx/trx0trx.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ struct TrxFactory {
186186
1024, MEM_HEAP_FOR_LOCK_HEAP);
187187
pthread_cond_init(&trx->lock.cond, nullptr);
188188

189-
lock_trx_lock_list_init(&trx->lock.trx_locks);
190-
189+
UT_LIST_INIT(trx->lock.trx_locks, &lock_t::trx_locks);
191190
UT_LIST_INIT(trx->lock.evicted_tables,
192191
&dict_table_t::table_LRU);
193192

0 commit comments

Comments
 (0)