File tree Expand file tree Collapse file tree 4 files changed +7
-50
lines changed Expand file tree Collapse file tree 4 files changed +7
-50
lines changed Original file line number Diff line number Diff line change @@ -2692,17 +2692,18 @@ static bool innobase_query_caching_table_check_low(
2692
2692
For read-only transaction: should satisfy (1) and (3)
2693
2693
For read-write transaction: should satisfy (1), (2), (3) */
2694
2694
2695
- if (lock_table_get_n_locks( table) ) {
2695
+ if (trx->id && trx->id < table->query_cache_inv_trx_id ) {
2696
2696
return false;
2697
2697
}
2698
2698
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) {
2700
2702
return false;
2701
2703
}
2702
2704
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;
2706
2707
}
2707
2708
2708
2709
/** Checks if MySQL at the moment is allowed for this table to retrieve a
Original file line number Diff line number Diff line change @@ -564,19 +564,6 @@ dberr_t
564
564
lock_trx_handle_wait (
565
565
/* =================*/
566
566
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 */
580
567
581
568
/* ********************************************************************/ /* *
582
569
Checks that a transaction id is sensible, i.e., not in the future.
Original file line number Diff line number Diff line change @@ -5621,25 +5621,6 @@ lock_trx_handle_wait(
5621
5621
return err;
5622
5622
}
5623
5623
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
-
5643
5624
#ifdef UNIV_DEBUG
5644
5625
/* *
5645
5626
Do an exhaustive check for any locks (table or rec) against the table.
@@ -5719,17 +5700,6 @@ lock_table_lock_list_init(
5719
5700
UT_LIST_INIT (*lock_list, &lock_table_t ::locks);
5720
5701
}
5721
5702
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
-
5733
5703
#ifdef UNIV_DEBUG
5734
5704
/* ******************************************************************/ /* *
5735
5705
Check if the transaction holds any locks on the sys tables
Original file line number Diff line number Diff line change @@ -186,8 +186,7 @@ struct TrxFactory {
186
186
1024 , MEM_HEAP_FOR_LOCK_HEAP);
187
187
pthread_cond_init (&trx->lock .cond , nullptr );
188
188
189
- lock_trx_lock_list_init (&trx->lock .trx_locks );
190
-
189
+ UT_LIST_INIT (trx->lock .trx_locks , &lock_t ::trx_locks);
191
190
UT_LIST_INIT (trx->lock .evicted_tables ,
192
191
&dict_table_t ::table_LRU);
193
192
You can’t perform that action at this time.
0 commit comments