1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.6 into 10.10

The MDEV-29693 conflict resolution is from Monty, as well as is
a bug fix where ANALYZE TABLE wrongly built histograms for
single-column PRIMARY KEY.
Also includes a fix for safe_malloc error reporting.

Other things:
- Copied main.log_slow from 10.4 to avoid mtr issue

Disabled test:
- spider/bugfix.mdev_27239 because we started to get
  +Error	1429 Unable to connect to foreign data source: localhost
  -Error	1158 Got an error reading communication packets
- main.delayed
  - Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
    This part is disabled for now as it fails randomly with different
    warnings/errors (no corruption).
This commit is contained in:
Marko Mäkelä
2023-10-13 15:14:37 +03:00
committed by Monty
436 changed files with 13299 additions and 28179 deletions

View File

@@ -69,8 +69,6 @@
#include "wsrep_thd.h"
#include "wsrep_trans_observer.h"
#include "wsrep_server_state.h"
#else
static inline bool wsrep_is_bf_aborted(THD* thd) { return false; }
#endif /* WITH_WSREP */
#include "opt_trace.h"
#include <mysql/psi/mysql_transaction.h>
@@ -1009,7 +1007,8 @@ void THD::raise_note(uint sql_errno)
{
DBUG_ENTER("THD::raise_note");
DBUG_PRINT("enter", ("code: %d", sql_errno));
if (!(variables.option_bits & OPTION_SQL_NOTES))
if (!(variables.option_bits & OPTION_SQL_NOTES) ||
(variables.note_verbosity == 0))
DBUG_VOID_RETURN;
const char* msg= ER_THD(this, sql_errno);
(void) raise_condition(sql_errno, "\0\0\0\0\0",
@@ -1023,7 +1022,8 @@ void THD::raise_note_printf(uint sql_errno, ...)
char ebuff[MYSQL_ERRMSG_SIZE];
DBUG_ENTER("THD::raise_note_printf");
DBUG_PRINT("enter",("code: %u", sql_errno));
if (!(variables.option_bits & OPTION_SQL_NOTES))
if (!(variables.option_bits & OPTION_SQL_NOTES) ||
(variables.note_verbosity == 0))
DBUG_VOID_RETURN;
const char* format= ER_THD(this, sql_errno);
va_start(args, sql_errno);
@@ -1046,8 +1046,9 @@ Sql_condition* THD::raise_condition(const Sql_condition *cond)
DBUG_ENTER("THD::raise_condition");
DBUG_ASSERT(level < Sql_condition::WARN_LEVEL_END);
if (!(variables.option_bits & OPTION_SQL_NOTES) &&
(level == Sql_condition::WARN_LEVEL_NOTE))
if ((level == Sql_condition::WARN_LEVEL_NOTE) &&
(!(variables.option_bits & OPTION_SQL_NOTES) ||
(variables.note_verbosity == 0)))
DBUG_RETURN(NULL);
#ifdef WITH_WSREP
/*
@@ -1730,7 +1731,9 @@ THD::~THD()
lf_hash_put_pins(tdc_hash_pins);
if (xid_hash_pins)
lf_hash_put_pins(xid_hash_pins);
#if defined(ENABLED_DEBUG_SYNC)
debug_sync_end_thread(this);
#endif
/* Ensure everything is freed */
status_var.local_memory_used-= sizeof(THD);
@@ -1745,7 +1748,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);
}
@@ -5848,7 +5851,6 @@ void THD::restore_sub_statement_state(Sub_statement_state *backup)
The following is added to the old values as we are interested in the
total complexity of the query
*/
inc_examined_row_count(backup->examined_row_count);
cuted_fields+= backup->cuted_fields;
DBUG_VOID_RETURN;
}
@@ -5931,6 +5933,8 @@ void THD::set_examined_row_count(ha_rows count)
void THD::inc_sent_row_count(ha_rows count)
{
m_sent_row_count+= count;
DBUG_EXECUTE_IF("debug_huge_number_of_examined_rows",
m_examined_row_count= (ULONGLONG_MAX - 1000000););
MYSQL_SET_STATEMENT_ROWS_SENT(m_statement_psi, m_sent_row_count);
}
@@ -7943,6 +7947,7 @@ wait_for_commit::reinit()
wakeup_error= 0;
wakeup_subsequent_commits_running= false;
commit_started= false;
wakeup_blocked= false;
#ifdef SAFE_MUTEX
/*
When using SAFE_MUTEX, the ordering between taking the LOCK_wait_commit
@@ -8216,6 +8221,9 @@ wait_for_commit::wakeup_subsequent_commits2(int wakeup_error)
{
wait_for_commit *waiter;
if (unlikely(wakeup_blocked))
return;
mysql_mutex_lock(&LOCK_wait_commit);
wakeup_subsequent_commits_running= true;
waiter= subsequent_commits_list;