Commit ccd409b5 authored by vasil's avatar vasil

lock_get_type() needs to be accessed outside of the lock module, but it

is inline and accesses lock_t members.

As advised by Marko rename lock_get_type() to lock_get_type_low() and
create a public non-inline function lock_get_type() which calls
lock_get_type_low().

Approved by:	Marko
parent de61e2c1
...@@ -674,6 +674,16 @@ lock_number_of_rows_locked( ...@@ -674,6 +674,16 @@ lock_number_of_rows_locked(
/*=======================*/ /*=======================*/
trx_t* trx); /* in: transaction */ trx_t* trx); /* in: transaction */
/***********************************************************************
Gets the type of a lock. Non-inline version for using outside of the
lock module. */
ulint
lock_get_type(
/*==========*/
/* out: LOCK_TABLE or LOCK_REC */
const lock_t* lock); /* in: lock */
/*********************************************************************** /***********************************************************************
Gets the id of the transaction owning a lock. */ Gets the id of the transaction owning a lock. */
......
...@@ -67,8 +67,8 @@ struct lock_struct { ...@@ -67,8 +67,8 @@ struct lock_struct {
Gets the type of a lock. */ Gets the type of a lock. */
UNIV_INLINE UNIV_INLINE
ulint ulint
lock_get_type( lock_get_type_low(
/*==========*/ /*==============*/
/* out: LOCK_TABLE or LOCK_REC */ /* out: LOCK_TABLE or LOCK_REC */
const lock_t* lock); /* in: lock */ const lock_t* lock); /* in: lock */
......
...@@ -19,8 +19,8 @@ methods but they are used only in that file. */ ...@@ -19,8 +19,8 @@ methods but they are used only in that file. */
Gets the type of a lock. */ Gets the type of a lock. */
UNIV_INLINE UNIV_INLINE
ulint ulint
lock_get_type( lock_get_type_low(
/*==========*/ /*==============*/
/* out: LOCK_TABLE or LOCK_REC */ /* out: LOCK_TABLE or LOCK_REC */
const lock_t* lock) /* in: lock */ const lock_t* lock) /* in: lock */
{ {
......
...@@ -41,7 +41,7 @@ lock_queue_iterator_reset( ...@@ -41,7 +41,7 @@ lock_queue_iterator_reset(
iter->bit_no = bit_no; iter->bit_no = bit_no;
} else { } else {
switch (lock_get_type(lock)) { switch (lock_get_type_low(lock)) {
case LOCK_TABLE: case LOCK_TABLE:
iter->bit_no = ULINT_UNDEFINED; iter->bit_no = ULINT_UNDEFINED;
break; break;
...@@ -68,7 +68,7 @@ lock_queue_iterator_get_prev( ...@@ -68,7 +68,7 @@ lock_queue_iterator_get_prev(
{ {
const lock_t* prev_lock; const lock_t* prev_lock;
switch (lock_get_type(iter->current_lock)) { switch (lock_get_type_low(iter->current_lock)) {
case LOCK_REC: case LOCK_REC:
prev_lock = lock_rec_get_prev( prev_lock = lock_rec_get_prev(
iter->current_lock, iter->bit_no); iter->current_lock, iter->bit_no);
......
...@@ -436,7 +436,7 @@ lock_rec_get_nth_bit( ...@@ -436,7 +436,7 @@ lock_rec_get_nth_bit(
ulint bit_index; ulint bit_index;
ut_ad(lock); ut_ad(lock);
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
if (i >= lock->un_member.rec_lock.n_bits) { if (i >= lock->un_member.rec_lock.n_bits) {
...@@ -667,7 +667,7 @@ lock_get_src_table( ...@@ -667,7 +667,7 @@ lock_get_src_table(
lock = UT_LIST_GET_NEXT(trx_locks, lock)) { lock = UT_LIST_GET_NEXT(trx_locks, lock)) {
lock_table_t* tab_lock; lock_table_t* tab_lock;
enum lock_mode lock_mode; enum lock_mode lock_mode;
if (!(lock_get_type(lock) & LOCK_TABLE)) { if (!(lock_get_type_low(lock) & LOCK_TABLE)) {
/* We are only interested in table locks. */ /* We are only interested in table locks. */
continue; continue;
} }
...@@ -737,7 +737,7 @@ lock_is_table_exclusive( ...@@ -737,7 +737,7 @@ lock_is_table_exclusive(
return(FALSE); return(FALSE);
} }
if (!(lock_get_type(lock) & LOCK_TABLE)) { if (!(lock_get_type_low(lock) & LOCK_TABLE)) {
/* We are interested in table locks only. */ /* We are interested in table locks only. */
continue; continue;
} }
...@@ -803,7 +803,7 @@ lock_rec_get_gap( ...@@ -803,7 +803,7 @@ lock_rec_get_gap(
const lock_t* lock) /* in: record lock */ const lock_t* lock) /* in: record lock */
{ {
ut_ad(lock); ut_ad(lock);
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
if (lock->type_mode & LOCK_GAP) { if (lock->type_mode & LOCK_GAP) {
...@@ -823,7 +823,7 @@ lock_rec_get_rec_not_gap( ...@@ -823,7 +823,7 @@ lock_rec_get_rec_not_gap(
const lock_t* lock) /* in: record lock */ const lock_t* lock) /* in: record lock */
{ {
ut_ad(lock); ut_ad(lock);
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
if (lock->type_mode & LOCK_REC_NOT_GAP) { if (lock->type_mode & LOCK_REC_NOT_GAP) {
...@@ -843,7 +843,7 @@ lock_rec_get_insert_intention( ...@@ -843,7 +843,7 @@ lock_rec_get_insert_intention(
const lock_t* lock) /* in: record lock */ const lock_t* lock) /* in: record lock */
{ {
ut_ad(lock); ut_ad(lock);
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
if (lock->type_mode & LOCK_INSERT_INTENTION) { if (lock->type_mode & LOCK_INSERT_INTENTION) {
...@@ -913,7 +913,7 @@ lock_rec_has_to_wait( ...@@ -913,7 +913,7 @@ lock_rec_has_to_wait(
request is really for a 'gap' type lock */ request is really for a 'gap' type lock */
{ {
ut_ad(trx && lock2); ut_ad(trx && lock2);
ut_ad(lock_get_type(lock2) == LOCK_REC); ut_ad(lock_get_type_low(lock2) == LOCK_REC);
if (trx != lock2->trx if (trx != lock2->trx
&& !lock_mode_compatible(LOCK_MODE_MASK & type_mode, && !lock_mode_compatible(LOCK_MODE_MASK & type_mode,
...@@ -992,8 +992,8 @@ lock_has_to_wait( ...@@ -992,8 +992,8 @@ lock_has_to_wait(
if (lock1->trx != lock2->trx if (lock1->trx != lock2->trx
&& !lock_mode_compatible(lock_get_mode(lock1), && !lock_mode_compatible(lock_get_mode(lock1),
lock_get_mode(lock2))) { lock_get_mode(lock2))) {
if (lock_get_type(lock1) == LOCK_REC) { if (lock_get_type_low(lock1) == LOCK_REC) {
ut_ad(lock_get_type(lock2) == LOCK_REC); ut_ad(lock_get_type_low(lock2) == LOCK_REC);
/* If this lock request is for a supremum record /* If this lock request is for a supremum record
then the second bit on the lock bitmap is set */ then the second bit on the lock bitmap is set */
...@@ -1037,7 +1037,7 @@ lock_rec_set_nth_bit( ...@@ -1037,7 +1037,7 @@ lock_rec_set_nth_bit(
ulint bit_index; ulint bit_index;
ut_ad(lock); ut_ad(lock);
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
ut_ad(i < lock->un_member.rec_lock.n_bits); ut_ad(i < lock->un_member.rec_lock.n_bits);
byte_index = i / 8; byte_index = i / 8;
...@@ -1084,7 +1084,7 @@ lock_rec_reset_nth_bit( ...@@ -1084,7 +1084,7 @@ lock_rec_reset_nth_bit(
ulint bit_index; ulint bit_index;
ut_ad(lock); ut_ad(lock);
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
ut_ad(i < lock->un_member.rec_lock.n_bits); ut_ad(i < lock->un_member.rec_lock.n_bits);
byte_index = i / 8; byte_index = i / 8;
...@@ -1106,7 +1106,7 @@ lock_rec_get_next_on_page( ...@@ -1106,7 +1106,7 @@ lock_rec_get_next_on_page(
ulint page_no; ulint page_no;
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
space = lock->un_member.rec_lock.space; space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no; page_no = lock->un_member.rec_lock.page_no;
...@@ -1233,7 +1233,7 @@ lock_rec_get_next( ...@@ -1233,7 +1233,7 @@ lock_rec_get_next(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
do { do {
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
lock = lock_rec_get_next_on_page(lock); lock = lock_rec_get_next_on_page(lock);
} while (lock && !lock_rec_get_nth_bit(lock, heap_no)); } while (lock && !lock_rec_get_nth_bit(lock, heap_no));
...@@ -1280,7 +1280,7 @@ lock_rec_bitmap_reset( ...@@ -1280,7 +1280,7 @@ lock_rec_bitmap_reset(
{ {
ulint n_bytes; ulint n_bytes;
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
/* Reset to zero the bitmap which resides immediately after the lock /* Reset to zero the bitmap which resides immediately after the lock
struct */ struct */
...@@ -1304,7 +1304,7 @@ lock_rec_copy( ...@@ -1304,7 +1304,7 @@ lock_rec_copy(
{ {
ulint size; ulint size;
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
size = sizeof(lock_t) + lock_rec_get_n_bits(lock) / 8; size = sizeof(lock_t) + lock_rec_get_n_bits(lock) / 8;
...@@ -1328,7 +1328,7 @@ lock_rec_get_prev( ...@@ -1328,7 +1328,7 @@ lock_rec_get_prev(
const lock_t* found_lock = NULL; const lock_t* found_lock = NULL;
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_type(in_lock) == LOCK_REC); ut_ad(lock_get_type_low(in_lock) == LOCK_REC);
space = in_lock->un_member.rec_lock.space; space = in_lock->un_member.rec_lock.space;
page_no = in_lock->un_member.rec_lock.page_no; page_no = in_lock->un_member.rec_lock.page_no;
...@@ -1639,7 +1639,7 @@ lock_number_of_rows_locked( ...@@ -1639,7 +1639,7 @@ lock_number_of_rows_locked(
lock = UT_LIST_GET_FIRST(trx->trx_locks); lock = UT_LIST_GET_FIRST(trx->trx_locks);
while (lock) { while (lock) {
if (lock_get_type(lock) == LOCK_REC) { if (lock_get_type_low(lock) == LOCK_REC) {
n_bits = lock_rec_get_n_bits(lock); n_bits = lock_rec_get_n_bits(lock);
for (n_bit = 0; n_bit < n_bits; n_bit++) { for (n_bit = 0; n_bit < n_bits; n_bit++) {
...@@ -2151,7 +2151,7 @@ lock_rec_has_to_wait_in_queue( ...@@ -2151,7 +2151,7 @@ lock_rec_has_to_wait_in_queue(
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_wait(wait_lock)); ut_ad(lock_get_wait(wait_lock));
ut_ad(lock_get_type(wait_lock) == LOCK_REC); ut_ad(lock_get_type_low(wait_lock) == LOCK_REC);
space = wait_lock->un_member.rec_lock.space; space = wait_lock->un_member.rec_lock.space;
page_no = wait_lock->un_member.rec_lock.page_no; page_no = wait_lock->un_member.rec_lock.page_no;
...@@ -2228,7 +2228,7 @@ lock_rec_cancel( ...@@ -2228,7 +2228,7 @@ lock_rec_cancel(
lock_t* lock) /* in: waiting record lock request */ lock_t* lock) /* in: waiting record lock request */
{ {
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
/* Reset the bit (there can be only one set bit) in the lock bitmap */ /* Reset the bit (there can be only one set bit) in the lock bitmap */
lock_rec_reset_nth_bit(lock, lock_rec_find_set_bit(lock)); lock_rec_reset_nth_bit(lock, lock_rec_find_set_bit(lock));
...@@ -2261,7 +2261,7 @@ lock_rec_dequeue_from_page( ...@@ -2261,7 +2261,7 @@ lock_rec_dequeue_from_page(
trx_t* trx; trx_t* trx;
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_type(in_lock) == LOCK_REC); ut_ad(lock_get_type_low(in_lock) == LOCK_REC);
trx = in_lock->trx; trx = in_lock->trx;
...@@ -2304,7 +2304,7 @@ lock_rec_discard( ...@@ -2304,7 +2304,7 @@ lock_rec_discard(
trx_t* trx; trx_t* trx;
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_type(in_lock) == LOCK_REC); ut_ad(lock_get_type_low(in_lock) == LOCK_REC);
trx = in_lock->trx; trx = in_lock->trx;
...@@ -3311,7 +3311,7 @@ lock_deadlock_occurs( ...@@ -3311,7 +3311,7 @@ lock_deadlock_occurs(
} }
if (UNIV_UNLIKELY(ret == LOCK_VICTIM_IS_START)) { if (UNIV_UNLIKELY(ret == LOCK_VICTIM_IS_START)) {
if (lock_get_type(lock) & LOCK_TABLE) { if (lock_get_type_low(lock) & LOCK_TABLE) {
table = lock->un_member.tab_lock.table; table = lock->un_member.tab_lock.table;
index = NULL; index = NULL;
} else { } else {
...@@ -3375,7 +3375,7 @@ lock_deadlock_recursive( ...@@ -3375,7 +3375,7 @@ lock_deadlock_recursive(
lock = wait_lock; lock = wait_lock;
if (lock_get_type(wait_lock) == LOCK_REC) { if (lock_get_type_low(wait_lock) == LOCK_REC) {
bit_no = lock_rec_find_set_bit(wait_lock); bit_no = lock_rec_find_set_bit(wait_lock);
...@@ -3385,12 +3385,12 @@ lock_deadlock_recursive( ...@@ -3385,12 +3385,12 @@ lock_deadlock_recursive(
/* Look at the locks ahead of wait_lock in the lock queue */ /* Look at the locks ahead of wait_lock in the lock queue */
for (;;) { for (;;) {
if (lock_get_type(lock) & LOCK_TABLE) { if (lock_get_type_low(lock) & LOCK_TABLE) {
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
lock); lock);
} else { } else {
ut_ad(lock_get_type(lock) == LOCK_REC); ut_ad(lock_get_type_low(lock) == LOCK_REC);
ut_a(bit_no != ULINT_UNDEFINED); ut_a(bit_no != ULINT_UNDEFINED);
lock = (lock_t*) lock_rec_get_prev(lock, bit_no); lock = (lock_t*) lock_rec_get_prev(lock, bit_no);
...@@ -3429,7 +3429,7 @@ lock_deadlock_recursive( ...@@ -3429,7 +3429,7 @@ lock_deadlock_recursive(
fputs("*** (1) WAITING FOR THIS LOCK" fputs("*** (1) WAITING FOR THIS LOCK"
" TO BE GRANTED:\n", ef); " TO BE GRANTED:\n", ef);
if (lock_get_type(wait_lock) == LOCK_REC) { if (lock_get_type_low(wait_lock) == LOCK_REC) {
lock_rec_print(ef, wait_lock); lock_rec_print(ef, wait_lock);
} else { } else {
lock_table_print(ef, wait_lock); lock_table_print(ef, wait_lock);
...@@ -3441,7 +3441,7 @@ lock_deadlock_recursive( ...@@ -3441,7 +3441,7 @@ lock_deadlock_recursive(
fputs("*** (2) HOLDS THE LOCK(S):\n", ef); fputs("*** (2) HOLDS THE LOCK(S):\n", ef);
if (lock_get_type(lock) == LOCK_REC) { if (lock_get_type_low(lock) == LOCK_REC) {
lock_rec_print(ef, lock); lock_rec_print(ef, lock);
} else { } else {
lock_table_print(ef, lock); lock_table_print(ef, lock);
...@@ -3450,7 +3450,7 @@ lock_deadlock_recursive( ...@@ -3450,7 +3450,7 @@ lock_deadlock_recursive(
fputs("*** (2) WAITING FOR THIS LOCK" fputs("*** (2) WAITING FOR THIS LOCK"
" TO BE GRANTED:\n", ef); " TO BE GRANTED:\n", ef);
if (lock_get_type(start->wait_lock) if (lock_get_type_low(start->wait_lock)
== LOCK_REC) { == LOCK_REC) {
lock_rec_print(ef, start->wait_lock); lock_rec_print(ef, start->wait_lock);
} else { } else {
...@@ -3856,7 +3856,7 @@ lock_table_dequeue( ...@@ -3856,7 +3856,7 @@ lock_table_dequeue(
lock_t* lock; lock_t* lock;
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_a(lock_get_type(in_lock) == LOCK_TABLE); ut_a(lock_get_type_low(in_lock) == LOCK_TABLE);
lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock); lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
...@@ -4009,11 +4009,11 @@ lock_release_off_kernel( ...@@ -4009,11 +4009,11 @@ lock_release_off_kernel(
count++; count++;
if (lock_get_type(lock) == LOCK_REC) { if (lock_get_type_low(lock) == LOCK_REC) {
lock_rec_dequeue_from_page(lock); lock_rec_dequeue_from_page(lock);
} else { } else {
ut_ad(lock_get_type(lock) & LOCK_TABLE); ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
if (lock_get_mode(lock) != LOCK_IS if (lock_get_mode(lock) != LOCK_IS
&& !ut_dulint_is_zero(trx->undo_no)) { && !ut_dulint_is_zero(trx->undo_no)) {
...@@ -4061,11 +4061,11 @@ lock_cancel_waiting_and_release( ...@@ -4061,11 +4061,11 @@ lock_cancel_waiting_and_release(
{ {
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
if (lock_get_type(lock) == LOCK_REC) { if (lock_get_type_low(lock) == LOCK_REC) {
lock_rec_dequeue_from_page(lock); lock_rec_dequeue_from_page(lock);
} else { } else {
ut_ad(lock_get_type(lock) & LOCK_TABLE); ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
lock_table_dequeue(lock); lock_table_dequeue(lock);
} }
...@@ -4099,12 +4099,12 @@ lock_reset_all_on_table_for_trx( ...@@ -4099,12 +4099,12 @@ lock_reset_all_on_table_for_trx(
while (lock != NULL) { while (lock != NULL) {
prev_lock = UT_LIST_GET_PREV(trx_locks, lock); prev_lock = UT_LIST_GET_PREV(trx_locks, lock);
if (lock_get_type(lock) == LOCK_REC if (lock_get_type_low(lock) == LOCK_REC
&& lock->index->table == table) { && lock->index->table == table) {
ut_a(!lock_get_wait(lock)); ut_a(!lock_get_wait(lock));
lock_rec_discard(lock); lock_rec_discard(lock);
} else if (lock_get_type(lock) & LOCK_TABLE } else if (lock_get_type_low(lock) & LOCK_TABLE
&& lock->un_member.tab_lock.table == table) { && lock->un_member.tab_lock.table == table) {
ut_a(!lock_get_wait(lock)); ut_a(!lock_get_wait(lock));
...@@ -4154,7 +4154,7 @@ lock_table_print( ...@@ -4154,7 +4154,7 @@ lock_table_print(
const lock_t* lock) /* in: table type lock */ const lock_t* lock) /* in: table type lock */
{ {
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_a(lock_get_type(lock) == LOCK_TABLE); ut_a(lock_get_type_low(lock) == LOCK_TABLE);
fputs("TABLE LOCK table ", file); fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, TRUE, ut_print_name(file, lock->trx, TRUE,
...@@ -4205,7 +4205,7 @@ lock_rec_print( ...@@ -4205,7 +4205,7 @@ lock_rec_print(
*offsets_ = (sizeof offsets_) / sizeof *offsets_; *offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(mutex_own(&kernel_mutex)); ut_ad(mutex_own(&kernel_mutex));
ut_a(lock_get_type(lock) == LOCK_REC); ut_a(lock_get_type_low(lock) == LOCK_REC);
space = lock->un_member.rec_lock.space; space = lock->un_member.rec_lock.space;
zip_size = fil_space_get_zip_size(space); zip_size = fil_space_get_zip_size(space);
...@@ -4455,7 +4455,7 @@ lock_print_info_all_transactions( ...@@ -4455,7 +4455,7 @@ lock_print_info_all_transactions(
(ulong) difftime(time(NULL), (ulong) difftime(time(NULL),
trx->wait_started)); trx->wait_started));
if (lock_get_type(trx->wait_lock) == LOCK_REC) { if (lock_get_type_low(trx->wait_lock) == LOCK_REC) {
lock_rec_print(file, trx->wait_lock); lock_rec_print(file, trx->wait_lock);
} else { } else {
lock_table_print(file, trx->wait_lock); lock_table_print(file, trx->wait_lock);
...@@ -4489,7 +4489,7 @@ lock_print_info_all_transactions( ...@@ -4489,7 +4489,7 @@ lock_print_info_all_transactions(
goto loop; goto loop;
} }
if (lock_get_type(lock) == LOCK_REC) { if (lock_get_type_low(lock) == LOCK_REC) {
if (load_page_first) { if (load_page_first) {
ulint space = lock->un_member.rec_lock.space; ulint space = lock->un_member.rec_lock.space;
ulint zip_size= fil_space_get_zip_size(space); ulint zip_size= fil_space_get_zip_size(space);
...@@ -4515,7 +4515,7 @@ lock_print_info_all_transactions( ...@@ -4515,7 +4515,7 @@ lock_print_info_all_transactions(
lock_rec_print(file, lock); lock_rec_print(file, lock);
} else { } else {
ut_ad(lock_get_type(lock) & LOCK_TABLE); ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
lock_table_print(file, lock); lock_table_print(file, lock);
} }
...@@ -4821,7 +4821,7 @@ lock_validate(void) ...@@ -4821,7 +4821,7 @@ lock_validate(void)
lock = UT_LIST_GET_FIRST(trx->trx_locks); lock = UT_LIST_GET_FIRST(trx->trx_locks);
while (lock) { while (lock) {
if (lock_get_type(lock) & LOCK_TABLE) { if (lock_get_type_low(lock) & LOCK_TABLE) {
lock_table_queue_validate( lock_table_queue_validate(
lock->un_member.tab_lock.table); lock->un_member.tab_lock.table);
...@@ -5361,6 +5361,19 @@ lock_clust_rec_read_check_and_lock_alt( ...@@ -5361,6 +5361,19 @@ lock_clust_rec_read_check_and_lock_alt(
return(ret); return(ret);
} }
/***********************************************************************
Gets the type of a lock. Non-inline version for using outside of the
lock module. */
ulint
lock_get_type(
/*==========*/
/* out: LOCK_TABLE or LOCK_REC */
const lock_t* lock) /* in: lock */
{
return(lock_get_type_low(lock));
}
/*********************************************************************** /***********************************************************************
Gets the id of the transaction owning a lock. */ Gets the id of the transaction owning a lock. */
...@@ -5409,7 +5422,7 @@ lock_get_type_str( ...@@ -5409,7 +5422,7 @@ lock_get_type_str(
/* out: lock type */ /* out: lock type */
const lock_t* lock) /* in: lock */ const lock_t* lock) /* in: lock */
{ {
switch (lock_get_type(lock)) { switch (lock_get_type_low(lock)) {
case LOCK_REC: case LOCK_REC:
return("RECORD"); return("RECORD");
case LOCK_TABLE: case LOCK_TABLE:
...@@ -5428,7 +5441,7 @@ lock_get_table( ...@@ -5428,7 +5441,7 @@ lock_get_table(
/* out: table */ /* out: table */
const lock_t* lock) /* in: lock */ const lock_t* lock) /* in: lock */
{ {
switch (lock_get_type(lock)) { switch (lock_get_type_low(lock)) {
case LOCK_REC: case LOCK_REC:
return(lock->index->table); return(lock->index->table);
case LOCK_TABLE: case LOCK_TABLE:
...@@ -5481,7 +5494,7 @@ lock_rec_get_index_name( ...@@ -5481,7 +5494,7 @@ lock_rec_get_index_name(
/* out: name of the index */ /* out: name of the index */
const lock_t* lock) /* in: lock */ const lock_t* lock) /* in: lock */
{ {
ut_a(lock_get_type(lock) == LOCK_REC); ut_a(lock_get_type_low(lock) == LOCK_REC);
return(lock->index->name); return(lock->index->name);
} }
...@@ -5495,7 +5508,7 @@ lock_rec_get_space_id( ...@@ -5495,7 +5508,7 @@ lock_rec_get_space_id(
/* out: tablespace number */ /* out: tablespace number */
const lock_t* lock) /* in: lock */ const lock_t* lock) /* in: lock */
{ {
ut_a(lock_get_type(lock) == LOCK_REC); ut_a(lock_get_type_low(lock) == LOCK_REC);
return(lock->un_member.rec_lock.space); return(lock->un_member.rec_lock.space);
} }
...@@ -5509,7 +5522,7 @@ lock_rec_get_page_no( ...@@ -5509,7 +5522,7 @@ lock_rec_get_page_no(
/* out: page number */ /* out: page number */
const lock_t* lock) /* in: lock */ const lock_t* lock) /* in: lock */
{ {
ut_a(lock_get_type(lock) == LOCK_REC); ut_a(lock_get_type_low(lock) == LOCK_REC);
return(lock->un_member.rec_lock.page_no); return(lock->un_member.rec_lock.page_no);
} }
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