1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2020-11-02 12:49:19 +02:00
627 changed files with 34558 additions and 13768 deletions

View File

@ -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();
@ -2588,7 +2589,7 @@ void THD::give_protection_error()
my_error(ER_BACKUP_LOCK_IS_ACTIVE, MYF(0));
else
{
DBUG_ASSERT(global_read_lock.is_acquired());
DBUG_ASSERT(global_read_lock.is_acquired() || mdl_backup_lock);
my_error(ER_CANT_UPDATE_WITH_READLOCK, MYF(0));
}
}
@ -6552,8 +6553,8 @@ exit:;
/**
Check if we should log a table DDL to the binlog
@@return true yes
@@return false no
@retval true yes
@retval false no
*/
bool THD::binlog_table_should_be_logged(const LEX_CSTRING *db)
@ -7442,14 +7443,14 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
*/
if (binlog_should_compress(query_len))
{
Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans, direct,
suppress_use, errcode);
Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans,
direct, suppress_use, errcode);
error= mysql_bin_log.write(&qinfo);
}
else
{
Query_log_event qinfo(this, query_arg, query_len, is_trans, direct,
suppress_use, errcode);
suppress_use, errcode);
error= mysql_bin_log.write(&qinfo);
}
/*
@ -7467,6 +7468,38 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
DBUG_RETURN(0);
}
/**
Binlog current query as a statement, ignoring the binlog filter setting.
The filter is in decide_logging_format() to mark queries to not be stored
in the binary log, for example by a shared distributed engine like S3.
This function resets the filter to ensure the the query is logged if
the binlog is active.
Note that 'direct' is set to false, which means that the query will
not be directly written to the binary log but instead to the cache.
@retval false ok
@retval true error
*/
bool THD::binlog_current_query_unfiltered()
{
if (!mysql_bin_log.is_open())
return 0;
reset_binlog_local_stmt_filter();
clear_binlog_local_stmt_filter();
return binlog_query(THD::STMT_QUERY_TYPE, query(), query_length(),
/* is_trans */ FALSE,
/* direct */ FALSE,
/* suppress_use */ FALSE,
/* Error */ 0) > 0;
}
void
THD::wait_for_wakeup_ready()
{
@ -7642,16 +7675,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");
@ -7701,10 +7751,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;
}