Skip to content

Commit f93a219

Browse files
committed
MDEV-13935 INSERT stuck at state Unlocking tables
lock_rec_queue_validate(): Restore some assertions. DeadlockChecker::select_victim(): Reduce the WSREP-related diff.
1 parent cac373f commit f93a219

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

storage/innobase/lock/lock0lock.cc

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ wsrep_kill_victim(
12841284
}
12851285

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

5672-
if (impl_trx != NULL) {
5673-
const lock_t* other_lock
5674-
= lock_rec_other_has_expl_req(
5675-
LOCK_S, block, true, heap_no,
5676-
impl_trx);
5677-
5672+
if (!impl_trx) {
5673+
} else if (const lock_t* other_lock
5674+
= lock_rec_other_has_expl_req(
5675+
LOCK_S, block, true, heap_no,
5676+
impl_trx)) {
56785677
/* The impl_trx is holding an implicit lock on the
56795678
given record 'rec'. So there cannot be another
56805679
explicit granted lock. Also, there can be another
56815680
explicit waiting lock only if the impl_trx has an
56825681
explicit granted lock. */
56835682

5684-
if (other_lock != NULL) {
56855683
#ifdef WITH_WSREP
5686-
if (wsrep_on(other_lock->trx->mysql_thd) && !lock_get_wait(other_lock) ) {
5687-
5684+
if (wsrep_on(other_lock->trx->mysql_thd)) {
5685+
if (!lock_get_wait(other_lock) ) {
56885686
ib::info() << "WSREP impl BF lock conflict for my impl lock:\n BF:" <<
56895687
((wsrep_thd_is_BF(impl_trx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
56905688
wsrep_thd_exec_mode(impl_trx->mysql_thd) << " conflict: " <<
@@ -5702,18 +5700,16 @@ lock_rec_queue_validate(
57025700
wsrep_thd_query(otrx->mysql_thd);
57035701
}
57045702

5705-
if (wsrep_on(other_lock->trx->mysql_thd) && !lock_rec_has_expl(
5706-
LOCK_X | LOCK_REC_NOT_GAP,
5707-
block, heap_no, impl_trx)) {
5703+
if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
5704+
block, heap_no,
5705+
impl_trx)) {
57085706
ib::info() << "WSREP impl BF lock conflict";
57095707
}
5710-
#else /* !WITH_WSREP */
5711-
ut_a(lock_get_wait(other_lock));
5712-
ut_a(lock_rec_has_expl(
5713-
LOCK_X | LOCK_REC_NOT_GAP,
5714-
block, heap_no, impl_trx));
5708+
} else
57155709
#endif /* WITH_WSREP */
5716-
}
5710+
ut_ad(lock_get_wait(other_lock));
5711+
ut_ad(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
5712+
block, heap_no, impl_trx));
57175713
}
57185714
}
57195715

@@ -7575,23 +7571,18 @@ DeadlockChecker::select_victim() const
75757571
#ifdef WITH_WSREP
75767572
if (wsrep_thd_is_BF(m_start->mysql_thd, TRUE)) {
75777573
return(m_wait_lock->trx);
7578-
} else {
7579-
#endif /* WITH_WSREP */
7580-
return(m_start);
7581-
#ifdef WITH_WSREP
75827574
}
7583-
#endif
7575+
#endif /* WITH_WSREP */
7576+
return(m_start);
75847577
}
75857578

75867579
#ifdef WITH_WSREP
75877580
if (wsrep_thd_is_BF(m_wait_lock->trx->mysql_thd, TRUE)) {
75887581
return(m_start);
7589-
} else {
7590-
#endif /* WITH_WSREP */
7591-
return(m_wait_lock->trx);
7592-
#ifdef WITH_WSREP
75937582
}
7594-
#endif
7583+
#endif /* WITH_WSREP */
7584+
7585+
return(m_wait_lock->trx);
75957586
}
75967587

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

0 commit comments

Comments
 (0)