summaryrefslogtreecommitdiff
path: root/storage/innobase/lock/lock0lock.c
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@oracle.com>2010-06-23 14:06:59 +0300
committerMarko Mäkelä <marko.makela@oracle.com>2010-06-23 14:06:59 +0300
commitc1567ecebd0aa682cb13b4859781c6f195b83f93 (patch)
tree822b4277a7f6ef5aee24d62eda6677db1a18303f /storage/innobase/lock/lock0lock.c
parenteb07ae46054907384b9453ea928135d27c58d801 (diff)
downloadmariadb-git-c1567ecebd0aa682cb13b4859781c6f195b83f93.tar.gz
Bug#54728: Replace the dulint struct with a 64-bit integer.
Diffstat (limited to 'storage/innobase/lock/lock0lock.c')
-rw-r--r--storage/innobase/lock/lock0lock.c77
1 files changed, 35 insertions, 42 deletions
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index 0e57a52666e..dcfca1b6315 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -468,7 +468,7 @@ lock_check_trx_id_sanity(
/* A sanity check: the trx_id in rec must be smaller than the global
trx id counter */
- if (ut_dulint_cmp(trx_id, trx_sys->max_trx_id) >= 0) {
+ if (UNIV_UNLIKELY(trx_id >= trx_sys->max_trx_id)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: transaction id associated"
" with record\n",
@@ -481,8 +481,7 @@ lock_check_trx_id_sanity(
" global trx id counter " TRX_ID_FMT "!\n"
"InnoDB: The table is corrupt. You have to do"
" dump + drop + reimport.\n",
- TRX_ID_PREP_PRINTF(trx_id),
- TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
+ (ullint) trx_id, (ullint) trx_sys->max_trx_id);
is_ok = FALSE;
}
@@ -556,9 +555,9 @@ lock_sec_rec_cons_read_sees(
}
max_trx_id = page_get_max_trx_id(page_align(rec));
- ut_ad(!ut_dulint_is_zero(max_trx_id));
+ ut_ad(max_trx_id);
- return(ut_dulint_cmp(max_trx_id, view->up_limit_id) < 0);
+ return(max_trx_id < view->up_limit_id);
}
/*********************************************************************//**
@@ -1594,8 +1593,7 @@ lock_sec_rec_some_has_impl_off_kernel(
max trx id to the log, and therefore during recovery, this value
for a page may be incorrect. */
- if (!(ut_dulint_cmp(page_get_max_trx_id(page),
- trx_list_get_min_trx_id()) >= 0)
+ if (page_get_max_trx_id(page) < trx_list_get_min_trx_id()
&& !recv_recovery_is_on()) {
return(NULL);
@@ -1820,8 +1818,8 @@ lock_rec_enqueue_waiting(
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fprintf(stderr, "Lock wait for trx %lu in index ",
- (ulong) ut_dulint_get_low(trx->id));
+ fprintf(stderr, "Lock wait for trx " TRX_ID_FMT " in index ",
+ (ullint) trx->id);
ut_print_name(stderr, trx, FALSE, index->name);
}
#endif /* UNIV_DEBUG */
@@ -2193,8 +2191,8 @@ lock_grant(
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fprintf(stderr, "Lock wait for trx %lu ends\n",
- (ulong) ut_dulint_get_low(lock->trx->id));
+ fprintf(stderr, "Lock wait for trx " TRX_ID_FMT " ends\n",
+ (ullint) lock->trx->id);
}
#endif /* UNIV_DEBUG */
@@ -3486,8 +3484,7 @@ lock_deadlock_recursive(
}
#endif /* UNIV_DEBUG */
- if (trx_weight_cmp(wait_lock->trx,
- start) >= 0) {
+ if (trx_weight_ge(wait_lock->trx, start)) {
/* Our recursion starting point
transaction is 'smaller', let us
choose 'start' as the victim and roll
@@ -4023,7 +4020,7 @@ lock_release_off_kernel(
ut_ad(lock_get_type_low(lock) & LOCK_TABLE);
if (lock_get_mode(lock) != LOCK_IS
- && !ut_dulint_is_zero(trx->undo_no)) {
+ && trx->undo_no != 0) {
/* The trx may have modified the table. We
block the use of the MySQL query cache for
@@ -4222,8 +4219,7 @@ lock_table_print(
fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, TRUE,
lock->un_member.tab_lock.table->name);
- fprintf(file, " trx id " TRX_ID_FMT,
- TRX_ID_PREP_PRINTF(lock->trx->id));
+ fprintf(file, " trx id " TRX_ID_FMT, (ullint) lock->trx->id);
if (lock_get_mode(lock) == LOCK_S) {
fputs(" lock mode S", file);
@@ -4276,8 +4272,7 @@ lock_rec_print(
(ulong) space, (ulong) page_no,
(ulong) lock_rec_get_n_bits(lock));
dict_index_name_print(file, lock->trx, lock->index);
- fprintf(file, " trx id " TRX_ID_FMT,
- TRX_ID_PREP_PRINTF(lock->trx->id));
+ fprintf(file, " trx id " TRX_ID_FMT, (ullint) lock->trx->id);
if (lock_get_mode(lock) == LOCK_S) {
fputs(" lock mode S", file);
@@ -4412,13 +4407,13 @@ lock_print_info_summary(
"------------\n", file);
fprintf(file, "Trx id counter " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(trx_sys->max_trx_id));
+ (ullint) trx_sys->max_trx_id);
fprintf(file,
"Purge done for trx's n:o < " TRX_ID_FMT
" undo n:o < " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(purge_sys->purge_trx_no),
- TRX_ID_PREP_PRINTF(purge_sys->purge_undo_no));
+ (ullint) purge_sys->purge_trx_no,
+ (ullint) purge_sys->purge_undo_no);
fprintf(file,
"History list length %lu\n",
@@ -4495,10 +4490,8 @@ loop:
"Trx read view will not see trx with"
" id >= " TRX_ID_FMT
", sees < " TRX_ID_FMT "\n",
- TRX_ID_PREP_PRINTF(
- trx->read_view->low_limit_id),
- TRX_ID_PREP_PRINTF(
- trx->read_view->up_limit_id));
+ (ullint) trx->read_view->low_limit_id,
+ (ullint) trx->read_view->up_limit_id);
}
if (trx->que_state == TRX_QUE_LOCK_WAIT) {
@@ -4912,12 +4905,12 @@ ibool
lock_validate(void)
/*===============*/
{
- lock_t* lock;
- trx_t* trx;
- dulint limit;
- ulint space;
- ulint page_no;
- ulint i;
+ lock_t* lock;
+ trx_t* trx;
+ ib_uint64_t limit;
+ ulint space;
+ ulint page_no;
+ ulint i;
lock_mutex_enter_kernel();
@@ -4941,20 +4934,21 @@ lock_validate(void)
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
- limit = ut_dulint_zero;
+ limit = 0;
for (;;) {
lock = HASH_GET_FIRST(lock_sys->rec_hash, i);
while (lock) {
+ ib_uint64_t space_page;
ut_a(trx_in_trx_list(lock->trx));
space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no;
- if (ut_dulint_cmp(
- ut_dulint_create(space, page_no),
- limit) >= 0) {
+ space_page = ut_ull_create(space, page_no);
+
+ if (space_page >= limit) {
break;
}
@@ -4974,7 +4968,7 @@ lock_validate(void)
lock_mutex_enter_kernel();
- limit = ut_dulint_create(space, page_no + 1);
+ limit = ut_ull_create(space, page_no + 1);
}
}
@@ -5348,8 +5342,7 @@ lock_sec_rec_read_check_and_lock(
if the max trx id for the page >= min trx id for the trx list or a
database recovery is running. */
- if (((ut_dulint_cmp(page_get_max_trx_id(block->frame),
- trx_list_get_min_trx_id()) >= 0)
+ if ((page_get_max_trx_id(block->frame) >= trx_list_get_min_trx_id()
|| recv_recovery_is_on())
&& !page_rec_is_supremum(rec)) {
@@ -5572,12 +5565,12 @@ lock_get_type(
Gets the id of the transaction owning a lock.
@return transaction id */
UNIV_INTERN
-ullint
+trx_id_t
lock_get_trx_id(
/*============*/
const lock_t* lock) /*!< in: lock */
{
- return(trx_get_id(lock->trx));
+ return(lock->trx->id);
}
/*******************************************************************//**
@@ -5671,7 +5664,7 @@ lock_get_table(
Gets the id of the table on which the lock is.
@return id of the table */
UNIV_INTERN
-ullint
+table_id_t
lock_get_table_id(
/*==============*/
const lock_t* lock) /*!< in: lock */
@@ -5680,7 +5673,7 @@ lock_get_table_id(
table = lock_get_table(lock);
- return((ullint)ut_conv_dulint_to_longlong(table->id));
+ return(table->id);
}
/*******************************************************************//**