Commit 662a8f4a authored by Sergey Vojtovich's avatar Sergey Vojtovich

Applying InnoDB snapshot

Detailed revision comments:

r6560 | sunny | 2010-02-04 16:11:23 +0200 (Thu, 04 Feb 2010) | 7 lines
branches/zip: Remove the additional check introduced in r6534 which tries
to check if the joining transaction has any other transactions waiting on
its locks. This optimization results in excessive deadlocks when running
Sysbench with a large number of threads. The function seems to return
FALSE positives.

rb://250
parent c3a7bf0d
...@@ -3311,64 +3311,6 @@ lock_deadlock_occurs( ...@@ -3311,64 +3311,6 @@ lock_deadlock_occurs(
return(FALSE); return(FALSE);
} }
/********************************************************************//**
Check that no other transaction is waiting on this transaction's locks.
@return TRUE if some other transaction is waiting for this lock. */
static
ulint
lock_trx_has_no_waiters(
/*====================*/
const trx_t* trx) /*!< in: the transaction to check */
{
const lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
for (lock = UT_LIST_GET_FIRST(trx->trx_locks);
lock != NULL;
lock = UT_LIST_GET_NEXT(trx_locks, lock)) {
const lock_t* wait_lock = lock;
/* Look for all transactions that could be waiting on this
transaction's locks. For that we need to search forward. */
if (lock_get_type_low(lock) == LOCK_REC) {
ulint heap_no;
/* It's possible for heap_no to be undefined here.
This can happen during lock move from one page to
another when we split. */
heap_no = lock_rec_find_set_bit(lock);
do {
wait_lock = lock_rec_get_next(
heap_no, (lock_t*) wait_lock);
if (wait_lock != NULL
&& lock_has_to_wait(wait_lock, lock)) {
return(FALSE);
}
} while (wait_lock != NULL);
} else {
do {
wait_lock = UT_LIST_GET_NEXT(
un_member.tab_lock.locks, wait_lock);
if (wait_lock != NULL
&& lock_has_to_wait(wait_lock, lock) ) {
return(FALSE);
}
} while (wait_lock != NULL);
}
}
return(TRUE);
}
/********************************************************************//** /********************************************************************//**
Looks recursively for a deadlock. Looks recursively for a deadlock.
@return 0 if no deadlock found, LOCK_VICTIM_IS_START if there was a @return 0 if no deadlock found, LOCK_VICTIM_IS_START if there was a
...@@ -3404,16 +3346,11 @@ lock_deadlock_recursive( ...@@ -3404,16 +3346,11 @@ lock_deadlock_recursive(
/* We have already exhaustively searched the subtree starting /* We have already exhaustively searched the subtree starting
from this trx */ from this trx */
return(0);
} else if (lock_trx_has_no_waiters(trx)) {
/* If no other transaction is waiting for this transaction
to release its locks then no deadlock can occur. */
return(0); return(0);
} }
*cost = *cost + 1; *cost = *cost + 1;
if (lock_get_type_low(wait_lock) == LOCK_REC) { if (lock_get_type_low(wait_lock) == LOCK_REC) {
ulint space; ulint space;
ulint page_no; ulint 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