1
0
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:
Oleksandr Byelkin
2023-11-08 12:59:00 +01:00
396 changed files with 10324 additions and 5797 deletions

View File

@ -707,6 +707,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),
@ -1237,6 +1238,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);
/*
@ -1756,7 +1758,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);
}
@ -5510,7 +5512,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))
@ -6287,11 +6289,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) &&
@ -6306,6 +6311,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) ||
@ -6313,7 +6339,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",
@ -6531,7 +6557,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
@ -6615,7 +6641,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))
{
/*
@ -6645,7 +6671,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())
{
@ -6789,7 +6815,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();
@ -6826,7 +6852,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);
@ -6891,7 +6917,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)));
}