Skip to content

Commit

Permalink
MDEV-28709 unexpected X lock on Supremum in READ COMMITTED
Browse files Browse the repository at this point in the history
Post-push fix. The flag of transaction which indicates that it's necessary
to forbid gap lock inheritance after XA PREPARE could be inverted if
lock_release_on_prepare_try() is invoked several times. The fix is to
toggle it on lock_release_on_prepare() exit.
  • Loading branch information
vlad-lesin committed Oct 28, 2022
1 parent 79dc398 commit 2f42168
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion storage/innobase/lock/lock0lock.cc
Expand Up @@ -4116,14 +4116,15 @@ static bool lock_release_on_prepare_try(trx_t *trx)

lock_sys.rd_unlock();
trx->mutex_unlock();
trx->set_skip_lock_inheritance();
return all_released;
}

/** Release non-exclusive locks on XA PREPARE,
and release possible other transactions waiting because of these locks. */
void lock_release_on_prepare(trx_t *trx)
{
auto _ = make_scope_exit([trx]() { trx->set_skip_lock_inheritance(); });

for (ulint count= 5; count--; )
if (lock_release_on_prepare_try(trx))
return;
Expand Down

0 comments on commit 2f42168

Please sign in to comment.