lock0lock.cc   lock0lock.cc 
skipping to change at line 1502 skipping to change at line 1502
ut_ad(lock_mutex_own()); ut_ad(lock_mutex_own());
ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S
|| (precise_mode & LOCK_MODE_MASK) == LOCK_X); || (precise_mode & LOCK_MODE_MASK) == LOCK_X);
ut_ad(!(precise_mode & LOCK_INSERT_INTENTION)); ut_ad(!(precise_mode & LOCK_INSERT_INTENTION));
for (lock = lock_rec_get_first(block, heap_no); for (lock = lock_rec_get_first(block, heap_no);
lock != NULL; lock != NULL;
lock = lock_rec_get_next(heap_no, lock)) { lock = lock_rec_get_next(heap_no, lock)) {
if (lock->trx == trx if (lock->trx == trx
&& !lock_rec_get_insert_intention(lock)
&& !lock_is_wait_not_by_other(lock->type_mode) && !lock_is_wait_not_by_other(lock->type_mode)
&& lock_mode_stronger_or_eq( && lock_mode_stronger_or_eq(
lock_get_mode(lock), lock_get_mode(lock),
static_cast<enum lock_mode>( static_cast<enum lock_mode>(
precise_mode & LOCK_MODE_MASK)) precise_mode & LOCK_MODE_MASK))
&& (!lock_rec_get_rec_not_gap(lock) && (!lock_rec_get_rec_not_gap(lock)
|| (precise_mode & LOCK_REC_NOT_GAP) || (precise_mode & LOCK_REC_NOT_GAP)
|| heap_no == PAGE_HEAP_NO_SUPREMUM) || heap_no == PAGE_HEAP_NO_SUPREMUM)
&& (!lock_rec_get_gap(lock) && (!lock_rec_get_gap(lock)
|| (precise_mode & LOCK_GAP) || (precise_mode & LOCK_GAP)
|| heap_no == PAGE_HEAP_NO_SUPREMUM) || heap_no == PAGE_HEAP_NO_SUPREMUM)) {
&& (!lock_rec_get_insert_intention(lock))) {
return(lock); return(lock);
} }
} }
return(NULL); return(NULL);
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/*********************************************************************//** /*********************************************************************//**
skipping to change at line 4437 skipping to change at line 4437
} }
lock_mutex_exit(); lock_mutex_exit();
trx_mutex_exit(trx); trx_mutex_exit(trx);
return(err); return(err);
} }
/*********************************************************************//** /*********************************************************************//**
Creates a table IX lock object for a resurrected transaction. */
UNIV_INTERN
void
lock_table_ix_resurrect(
/*====================*/
dict_table_t* table, /*!< in/out: table */
trx_t* trx) /*!< in/out: transaction */
{
ut_ad(trx->is_recovered);
if (lock_table_has(trx, table, LOCK_IX)) {
return;
}
lock_mutex_enter();
/* We have to check if the new lock is compatible with any locks
other transactions have in the table lock queue. */
ut_ad(!lock_table_other_has_incompatible(
trx, LOCK_WAIT, table, LOCK_IX));
trx_mutex_enter(trx);
lock_table_create(table, LOCK_IX, trx);
lock_mutex_exit();
trx_mutex_exit(trx);
}
/*********************************************************************//**
Checks if a waiting table lock request still has to wait in a queue. Checks if a waiting table lock request still has to wait in a queue.
@return TRUE if still has to wait */ @return TRUE if still has to wait */
static static
ibool ibool
lock_table_has_to_wait_in_queue( lock_table_has_to_wait_in_queue(
/*============================*/ /*============================*/
const lock_t* wait_lock) /*!< in: waiting table lock */ const lock_t* wait_lock) /*!< in: waiting table lock */
{ {
const dict_table_t* table; const dict_table_t* table;
const lock_t* lock; const lock_t* lock;
skipping to change at line 4829 skipping to change at line 4858
for (lock = UT_LIST_GET_FIRST(trx->lock.trx_locks); for (lock = UT_LIST_GET_FIRST(trx->lock.trx_locks);
lock != NULL; lock != NULL;
lock = next_lock) { lock = next_lock) {
ut_a(lock->trx == trx); ut_a(lock->trx == trx);
/* Recovered transactions can't wait on a lock. */ /* Recovered transactions can't wait on a lock. */
ut_a(!lock_get_wait(lock)); ut_a(!lock_get_wait(lock));
/* Recovered transactions don't have any
table level locks. */
ut_a(lock_get_type_low(lock) == LOCK_REC);
next_lock = UT_LIST_GET_NEXT(trx_locks, lock); next_lock = UT_LIST_GET_NEXT(trx_locks, lock);
if (lock->index->table == table) { switch (lock_get_type_low(lock)) {
lock_rec_discard(lock); default:
ut_error;
case LOCK_TABLE:
if (lock->un_member.tab_lock.table == table)
{
lock_trx_table_locks_remove(lock);
lock_table_remove_low(lock);
}
break;
case LOCK_REC:
if (lock->index->table == table) {
lock_rec_discard(lock);
}
} }
} }
++n_recovered_trx; ++n_recovered_trx;
} }
mutex_exit(&trx_sys->mutex); mutex_exit(&trx_sys->mutex);
return(n_recovered_trx); return(n_recovered_trx);
} }
skipping to change at line 7031 skipping to change at line 7066
strongest = mode; strongest = mode;
strongest_lock = lock; strongest_lock = lock;
} }
} }
lock_mutex_exit(); lock_mutex_exit();
return(strongest_lock); return(strongest_lock);
} }
/*******************************************************************//**
Check if the transaction holds an exclusive lock on a record.
@return whether the locks are held */
UNIV_INTERN
bool
lock_trx_has_rec_x_lock(
/*====================*/
const trx_t* trx, /*!< in: transaction to check */
const dict_table_t* table, /*!< in: table to check */
const buf_block_t* block, /*!< in: buffer block of the record
*/
ulint heap_no)/*!< in: record heap number */
{
ut_ad(heap_no > PAGE_HEAP_NO_SUPREMUM);
lock_mutex_enter();
ut_a(lock_table_has(trx, table, LOCK_IX));
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, trx));
lock_mutex_exit();
return(true);
}
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
 End of changes. 6 change blocks. 
9 lines changed or deleted 68 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/