mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '10.5' into 10.6
This commit is contained in:
@@ -8028,15 +8028,22 @@ wait_for_commit::register_wait_for_prior_commit(wait_for_commit *waitee)
|
||||
with register_wait_for_prior_commit(). If the commit already completed,
|
||||
returns immediately.
|
||||
|
||||
If ALLOW_KILL is set to true (the default), the wait can be aborted by a
|
||||
kill. In case of kill, the wait registration is still removed, so another
|
||||
call of unregister_wait_for_prior_commit() is needed to later retry the
|
||||
wait. If ALLOW_KILL is set to false, then kill will be ignored and this
|
||||
function will not return until the prior commit (if any) has called
|
||||
wakeup_subsequent_commits().
|
||||
|
||||
If thd->backup_commit_lock is set, release it while waiting for other threads
|
||||
*/
|
||||
|
||||
int
|
||||
wait_for_commit::wait_for_prior_commit2(THD *thd)
|
||||
wait_for_commit::wait_for_prior_commit2(THD *thd, bool allow_kill)
|
||||
{
|
||||
PSI_stage_info old_stage;
|
||||
wait_for_commit *loc_waitee;
|
||||
bool backup_lock_released= 0;
|
||||
bool backup_lock_released= false;
|
||||
|
||||
/*
|
||||
Release MDL_BACKUP_COMMIT LOCK while waiting for other threads to commit
|
||||
@@ -8046,7 +8053,7 @@ wait_for_commit::wait_for_prior_commit2(THD *thd)
|
||||
*/
|
||||
if (thd->backup_commit_lock && thd->backup_commit_lock->ticket)
|
||||
{
|
||||
backup_lock_released= 1;
|
||||
backup_lock_released= true;
|
||||
thd->mdl_context.release_lock(thd->backup_commit_lock->ticket);
|
||||
thd->backup_commit_lock->ticket= 0;
|
||||
}
|
||||
@@ -8057,7 +8064,7 @@ wait_for_commit::wait_for_prior_commit2(THD *thd)
|
||||
&stage_waiting_for_prior_transaction_to_commit,
|
||||
&old_stage);
|
||||
while ((loc_waitee= this->waitee.load(std::memory_order_relaxed)) &&
|
||||
likely(!thd->check_killed(1)))
|
||||
(!allow_kill || likely(!thd->check_killed(1))))
|
||||
mysql_cond_wait(&COND_wait_commit, &LOCK_wait_commit);
|
||||
if (!loc_waitee)
|
||||
{
|
||||
@@ -8099,14 +8106,14 @@ wait_for_commit::wait_for_prior_commit2(THD *thd)
|
||||
use within enter_cond/exit_cond.
|
||||
*/
|
||||
DEBUG_SYNC(thd, "wait_for_prior_commit_killed");
|
||||
if (backup_lock_released)
|
||||
if (unlikely(backup_lock_released))
|
||||
thd->mdl_context.acquire_lock(thd->backup_commit_lock,
|
||||
thd->variables.lock_wait_timeout);
|
||||
return wakeup_error;
|
||||
|
||||
end:
|
||||
thd->EXIT_COND(&old_stage);
|
||||
if (backup_lock_released)
|
||||
if (unlikely(backup_lock_released))
|
||||
thd->mdl_context.acquire_lock(thd->backup_commit_lock,
|
||||
thd->variables.lock_wait_timeout);
|
||||
return wakeup_error;
|
||||
|
Reference in New Issue
Block a user