diff options
author | unknown <knielsen@knielsen-hq.org> | 2010-04-28 15:53:04 +0200 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2010-04-28 15:53:04 +0200 |
commit | af2309a1709cd710dee72597ee7bb3bf93a90159 (patch) | |
tree | 5667dbaddbb52c19283376be1c4a21aa3180bc17 /storage/xtradb/lock | |
parent | d9a95a550055727983472cc530f9d27872293cb6 (diff) | |
parent | 0a3a94aee47d89cde779bd1c03c7e5a7be075184 (diff) | |
download | mariadb-git-af2309a1709cd710dee72597ee7bb3bf93a90159.tar.gz |
Merge XtraDB 9.1 into MariaDB.
Diffstat (limited to 'storage/xtradb/lock')
-rw-r--r-- | storage/xtradb/lock/lock0lock.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c index d1a37b13cd0..9067f96d238 100644 --- a/storage/xtradb/lock/lock0lock.c +++ b/storage/xtradb/lock/lock0lock.c @@ -3364,23 +3364,26 @@ lock_deadlock_recursive( bit_no = lock_rec_find_set_bit(wait_lock); ut_a(bit_no != ULINT_UNDEFINED); - } + + /* get the starting point for the search for row level locks + since we are scanning from the front of the list */ + lock = lock_rec_get_first_on_page_addr(wait_lock->un_member.rec_lock.space, + wait_lock->un_member.rec_lock.page_no); + } + else { + /* table level locks use a two-way linked list so scanning backwards is OK */ + lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, + lock); + } /* Look at the locks ahead of wait_lock in the lock queue */ for (;;) { - if (lock_get_type_low(lock) & LOCK_TABLE) { - - lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, - lock); - } else { - ut_ad(lock_get_type_low(lock) == LOCK_REC); - ut_a(bit_no != ULINT_UNDEFINED); - lock = (lock_t*) lock_rec_get_prev(lock, bit_no); - } - if (lock == NULL) { + /* reached the original lock in the queue for row level locks + or past beginning of the list for table level locks */ + if (lock == NULL || lock == wait_lock) { /* We can mark this subtree as searched */ trx->deadlock_mark = 1; @@ -3505,6 +3508,17 @@ lock_deadlock_recursive( } } } + + /* next lock to check */ + if (lock_get_type_low(lock) & LOCK_TABLE) { + lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, + lock); + } else { + ut_ad(lock_get_type_low(lock) == LOCK_REC); + ut_a(bit_no != ULINT_UNDEFINED); + + lock = (lock_t*) lock_rec_get_next(bit_no, lock); + } }/* end of the 'for (;;)'-loop */ } @@ -4336,11 +4350,6 @@ lock_print_info_summary( /*====================*/ FILE* file) /*!< in: file where to print */ { - /* We must protect the MySQL thd->query field with a MySQL mutex, and - because the MySQL mutex must be reserved before the kernel_mutex of - InnoDB, we call innobase_mysql_prepare_print_arbitrary_thd() here. */ - - innobase_mysql_prepare_print_arbitrary_thd(); lock_mutex_enter_kernel(); if (lock_deadlock_found) { @@ -4423,7 +4432,6 @@ loop: if (trx == NULL) { lock_mutex_exit_kernel(); - innobase_mysql_end_print_arbitrary_thd(); ut_ad(lock_validate()); @@ -4507,7 +4515,6 @@ loop: } lock_mutex_exit_kernel(); - innobase_mysql_end_print_arbitrary_thd(); mtr_start(&mtr); @@ -4518,7 +4525,6 @@ loop: load_page_first = FALSE; - innobase_mysql_prepare_print_arbitrary_thd(); lock_mutex_enter_kernel(); goto loop; |