mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge branch '10.4' into 10.5
This commit is contained in:
@ -1298,6 +1298,7 @@ void THD::init()
|
||||
first_successful_insert_id_in_prev_stmt_for_binlog= 0;
|
||||
first_successful_insert_id_in_cur_stmt= 0;
|
||||
current_backup_stage= BACKUP_FINISHED;
|
||||
backup_commit_lock= 0;
|
||||
#ifdef WITH_WSREP
|
||||
wsrep_last_query_id= 0;
|
||||
wsrep_xid.null();
|
||||
@ -7651,16 +7652,33 @@ wait_for_commit::register_wait_for_prior_commit(wait_for_commit *waitee)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Wait for commit of another transaction to complete, as already registered
|
||||
/**
|
||||
Waits for commit of another transaction to complete, as already registered
|
||||
with register_wait_for_prior_commit(). If the commit already completed,
|
||||
returns immediately.
|
||||
|
||||
If thd->backup_commit_lock is set, release it while waiting for other threads
|
||||
*/
|
||||
|
||||
int
|
||||
wait_for_commit::wait_for_prior_commit2(THD *thd)
|
||||
{
|
||||
PSI_stage_info old_stage;
|
||||
wait_for_commit *loc_waitee;
|
||||
bool backup_lock_released= 0;
|
||||
|
||||
/*
|
||||
Release MDL_BACKUP_COMMIT LOCK while waiting for other threads to commit
|
||||
This is needed to avoid deadlock between the other threads (which not
|
||||
yet have the MDL_BACKUP_COMMIT_LOCK) and any threads using
|
||||
BACKUP LOCK BLOCK_COMMIT.
|
||||
*/
|
||||
if (thd->backup_commit_lock && thd->backup_commit_lock->ticket)
|
||||
{
|
||||
backup_lock_released= 1;
|
||||
thd->mdl_context.release_lock(thd->backup_commit_lock->ticket);
|
||||
thd->backup_commit_lock->ticket= 0;
|
||||
}
|
||||
|
||||
mysql_mutex_lock(&LOCK_wait_commit);
|
||||
DEBUG_SYNC(thd, "wait_for_prior_commit_waiting");
|
||||
@ -7710,10 +7728,16 @@ 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)
|
||||
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)
|
||||
thd->mdl_context.acquire_lock(thd->backup_commit_lock,
|
||||
thd->variables.lock_wait_timeout);
|
||||
return wakeup_error;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user