1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.5' into 10.6

This commit is contained in:
Oleksandr Byelkin
2023-11-08 15:57:05 +01:00
381 changed files with 10233 additions and 5782 deletions

View File

@@ -711,6 +711,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
wsrep_ignore_table(false),
wsrep_aborter(0),
wsrep_delayed_BF_abort(false),
wsrep_ctas(false),
/* wsrep-lib */
m_wsrep_next_trx_id(WSREP_UNDEFINED_TRX_ID),
@@ -1245,6 +1246,7 @@ const Type_handler *THD::type_handler_for_datetime() const
void THD::init()
{
DBUG_ENTER("thd::init");
mdl_context.reset();
mysql_mutex_lock(&LOCK_global_system_variables);
plugin_thdvar_init(this);
/*
@@ -1766,7 +1768,7 @@ THD::~THD()
if (status_var.local_memory_used != 0)
{
DBUG_PRINT("error", ("memory_used: %lld", status_var.local_memory_used));
SAFEMALLOC_REPORT_MEMORY(thread_id);
SAFEMALLOC_REPORT_MEMORY(sf_malloc_dbug_id());
DBUG_ASSERT(status_var.local_memory_used == 0 ||
!debug_assert_on_not_freed_memory);
}
@@ -5566,7 +5568,7 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
if (WSREP(thd))
{
/* for wsrep binlog format is meaningful also when binlogging is off */
return (int) WSREP_BINLOG_FORMAT(thd->variables.binlog_format);
return (int) thd->wsrep_binlog_format(thd->variables.binlog_format);
}
if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG))
@@ -6348,11 +6350,14 @@ int THD::decide_logging_format(TABLE_LIST *tables)
reset_binlog_local_stmt_filter();
// Used binlog format
ulong binlog_format= wsrep_binlog_format(variables.binlog_format);
/*
We should not decide logging format if the binlog is closed or
binlogging is off, or if the statement is filtered out from the
binlog by filtering rules.
*/
#ifdef WITH_WSREP
if (WSREP_CLIENT_NNULL(this) &&
wsrep_thd_is_local(this) &&
@@ -6367,6 +6372,27 @@ int THD::decide_logging_format(TABLE_LIST *tables)
DBUG_RETURN(-1);
}
}
/*
If user has configured wsrep_forced_binlog_format to
STMT OR MIXED and used binlog_format would be same
and this is CREATE TABLE AS SELECT we will fall back
to ROW.
*/
if (wsrep_forced_binlog_format < BINLOG_FORMAT_ROW &&
wsrep_ctas)
{
if (!get_stmt_da()->has_sql_condition(ER_UNKNOWN_ERROR))
{
push_warning_printf(this, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_ERROR,
"Galera does not support wsrep_forced_binlog_format = %s "
"in CREATE TABLE AS SELECT",
wsrep_forced_binlog_format == BINLOG_FORMAT_STMT ?
"STMT" : "MIXED");
}
set_current_stmt_binlog_format_row();
}
#endif /* WITH_WSREP */
if (WSREP_EMULATE_BINLOG_NNULL(this) ||
@@ -6374,7 +6400,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
{
if (is_bulk_op())
{
if (wsrep_binlog_format() == BINLOG_FORMAT_STMT)
if (binlog_format == BINLOG_FORMAT_STMT)
{
my_error(ER_BINLOG_NON_SUPPORTED_BULK, MYF(0));
DBUG_PRINT("info",
@@ -6592,7 +6618,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
prev_access_table= table;
}
if (wsrep_binlog_format() != BINLOG_FORMAT_ROW)
if (binlog_format != BINLOG_FORMAT_ROW)
{
/*
DML statements that modify a table with an auto_increment
@@ -6676,7 +6702,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
*/
my_error((error= ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE), MYF(0));
}
else if ((wsrep_binlog_format() == BINLOG_FORMAT_ROW || is_bulk_op()) &&
else if ((binlog_format == BINLOG_FORMAT_ROW || is_bulk_op()) &&
sqlcom_can_generate_row_events(this))
{
/*
@@ -6706,7 +6732,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
else
{
/* binlog_format = STATEMENT */
if (wsrep_binlog_format() == BINLOG_FORMAT_STMT)
if (binlog_format == BINLOG_FORMAT_STMT)
{
if (lex->is_stmt_row_injection())
{
@@ -6850,7 +6876,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
"and binlog_filter->db_ok(db) = %d",
mysql_bin_log.is_open(),
(variables.option_bits & OPTION_BIN_LOG),
(uint) wsrep_binlog_format(),
(uint) binlog_format,
binlog_filter->db_ok(db.str)));
if (WSREP_NNULL(this) && is_current_stmt_binlog_format_row())
binlog_prepare_for_row_logging();
@@ -6887,7 +6913,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
void THD::reconsider_logging_format_for_iodup(TABLE *table)
{
DBUG_ENTER("reconsider_logging_format_for_iodup");
enum_binlog_format bf= (enum_binlog_format) wsrep_binlog_format();
enum_binlog_format bf= (enum_binlog_format) wsrep_binlog_format(variables.binlog_format);
DBUG_ASSERT(lex->duplicates == DUP_UPDATE);
@@ -6952,7 +6978,7 @@ bool THD::binlog_table_should_be_logged(const LEX_CSTRING *db)
{
return (mysql_bin_log.is_open() &&
(variables.option_bits & OPTION_BIN_LOG) &&
(wsrep_binlog_format() != BINLOG_FORMAT_STMT ||
(wsrep_binlog_format(variables.binlog_format) != BINLOG_FORMAT_STMT ||
binlog_filter->db_ok(db->str)));
}