Skip to content
Permalink
Browse files
MDEV-13935 INSERT stuck at state Unlocking tables
lock_rec_queue_validate(): Restore some assertions.

DeadlockChecker::select_victim(): Reduce the WSREP-related diff.
  • Loading branch information
dr-m committed Mar 16, 2018
1 parent cac373f commit f93a219
Showing 1 changed file with 20 additions and 29 deletions.
@@ -1284,7 +1284,7 @@ wsrep_kill_victim(
}

wsrep_innobase_kill_one_trx(trx->mysql_thd,
(const trx_t*) trx, lock->trx, TRUE);
trx, lock->trx, TRUE);
}
}
}
@@ -5669,22 +5669,20 @@ lock_rec_queue_validate(
/* impl_trx cannot be committed until lock_mutex_exit()
because lock_trx_release_locks() acquires lock_sys->mutex */

if (impl_trx != NULL) {
const lock_t* other_lock
= lock_rec_other_has_expl_req(
LOCK_S, block, true, heap_no,
impl_trx);

if (!impl_trx) {
} else if (const lock_t* other_lock
= lock_rec_other_has_expl_req(
LOCK_S, block, true, heap_no,
impl_trx)) {
/* The impl_trx is holding an implicit lock on the
given record 'rec'. So there cannot be another
explicit granted lock. Also, there can be another
explicit waiting lock only if the impl_trx has an
explicit granted lock. */

if (other_lock != NULL) {
#ifdef WITH_WSREP
if (wsrep_on(other_lock->trx->mysql_thd) && !lock_get_wait(other_lock) ) {

if (wsrep_on(other_lock->trx->mysql_thd)) {
if (!lock_get_wait(other_lock) ) {
ib::info() << "WSREP impl BF lock conflict for my impl lock:\n BF:" <<
((wsrep_thd_is_BF(impl_trx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
wsrep_thd_exec_mode(impl_trx->mysql_thd) << " conflict: " <<
@@ -5702,18 +5700,16 @@ lock_rec_queue_validate(
wsrep_thd_query(otrx->mysql_thd);
}

if (wsrep_on(other_lock->trx->mysql_thd) && !lock_rec_has_expl(
LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx)) {
if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no,
impl_trx)) {
ib::info() << "WSREP impl BF lock conflict";
}
#else /* !WITH_WSREP */
ut_a(lock_get_wait(other_lock));
ut_a(lock_rec_has_expl(
LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx));
} else
#endif /* WITH_WSREP */
}
ut_ad(lock_get_wait(other_lock));
ut_ad(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx));
}
}

@@ -7575,23 +7571,18 @@ DeadlockChecker::select_victim() const
#ifdef WITH_WSREP
if (wsrep_thd_is_BF(m_start->mysql_thd, TRUE)) {
return(m_wait_lock->trx);
} else {
#endif /* WITH_WSREP */
return(m_start);
#ifdef WITH_WSREP
}
#endif
#endif /* WITH_WSREP */
return(m_start);
}

#ifdef WITH_WSREP
if (wsrep_thd_is_BF(m_wait_lock->trx->mysql_thd, TRUE)) {
return(m_start);
} else {
#endif /* WITH_WSREP */
return(m_wait_lock->trx);
#ifdef WITH_WSREP
}
#endif
#endif /* WITH_WSREP */

return(m_wait_lock->trx);
}

/** Looks iteratively for a deadlock. Note: the joining transaction may

0 comments on commit f93a219

Please sign in to comment.