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

Merge 11.2 into 11.3

This commit is contained in:
Marko Mäkelä
2023-10-27 10:48:29 +03:00
511 changed files with 15169 additions and 29021 deletions

View File

@@ -454,7 +454,8 @@ private:
class Key :public Sql_alloc, public DDL_options {
public:
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY};
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FULLTEXT, SPATIAL, FOREIGN_KEY,
IGNORE_KEY};
enum Keytype type;
KEY_CREATE_INFO key_create_info;
List<Key_part_spec> columns;
@@ -708,6 +709,7 @@ typedef struct system_variables
ulonglong log_slow_verbosity;
ulonglong log_slow_disabled_statements;
ulonglong log_disabled_statements;
ulonglong note_verbosity;
ulonglong bulk_insert_buff_size;
ulonglong join_buff_size;
ulonglong sortbuff_size;
@@ -766,6 +768,8 @@ typedef struct system_variables
ulong optimizer_selectivity_sampling_limit;
ulong optimizer_use_condition_selectivity;
ulong optimizer_trace_max_mem_size;
ulong optimizer_max_sel_arg_weight;
ulong optimizer_max_sel_args;
ulong use_stat_tables;
ulong histogram_size;
ulong histogram_type;
@@ -787,6 +791,7 @@ typedef struct system_variables
ulong trans_prealloc_size;
ulong log_warnings;
ulong block_encryption_mode;
ulong log_slow_max_warnings;
/* Flags for slow log filtering */
ulong log_slow_rate_limit;
ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format)
@@ -800,7 +805,6 @@ typedef struct system_variables
ulong server_id;
ulong session_track_transaction_info;
ulong threadpool_priority;
ulong optimizer_max_sel_arg_weight;
ulong vers_alter_history;
/* deadlock detection */
@@ -1187,11 +1191,21 @@ public:
Prepared statement: STMT_INITIALIZED -> STMT_PREPARED -> STMT_EXECUTED.
Stored procedure: STMT_INITIALIZED_FOR_SP -> STMT_EXECUTED.
Other statements: STMT_CONVENTIONAL_EXECUTION never changes.
Special case for stored procedure arguments: STMT_SP_QUERY_ARGUMENTS
This state never changes and used for objects
whose lifetime is whole duration of function call
(sp_rcontext, it's tables and items. etc). Such objects
should be deallocated after every execution of a stored
routine. Caller's arena/memroot can't be used for
placing such objects since memory allocated on caller's
arena not freed until termination of user's session.
*/
enum enum_state
{
STMT_INITIALIZED= 0, STMT_INITIALIZED_FOR_SP= 1, STMT_PREPARED= 2,
STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1
STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4,
STMT_SP_QUERY_ARGUMENTS= 5, STMT_ERROR= -1
};
enum_state state;
@@ -2125,11 +2139,17 @@ private:
/**
Implements the trivial error handler which cancels all error states
and prevents an SQLSTATE to be set.
Remembers the first error
*/
class Dummy_error_handler : public Internal_error_handler
{
uint m_unhandled_errors;
uint first_error;
public:
Dummy_error_handler()
: m_unhandled_errors(0), first_error(0)
{}
bool handle_condition(THD *thd,
uint sql_errno,
const char* sqlstate,
@@ -2137,13 +2157,15 @@ public:
const char* msg,
Sql_condition ** cond_hdl)
{
/* Ignore error */
return TRUE;
m_unhandled_errors++;
if (!first_error)
first_error= sql_errno;
return TRUE; // Ignore error
}
Dummy_error_handler() = default; /* Remove gcc warning */
bool any_error() { return m_unhandled_errors != 0; }
uint got_error() { return first_error; }
};
/**
Implements the trivial error handler which counts errors as they happen.
*/
@@ -2482,6 +2504,19 @@ struct wait_for_commit
group commit as T1.
*/
bool commit_started;
/*
Set to temporarily ignore calls to wakeup_subsequent_commits(). The
caller must arrange that another wakeup_subsequent_commits() gets called
later after wakeup_blocked has been set back to false.
This is used for parallel replication with temporary tables.
Temporary tables require strict single-threaded operation. The normal
optimization, of doing wakeup_subsequent_commits early and overlapping
part of the commit with the following transaction, is not safe. Thus
when temporary tables are replicated, wakeup is blocked until the
event group is fully done.
*/
bool wakeup_blocked;
void register_wait_for_prior_commit(wait_for_commit *waitee);
int wait_for_prior_commit(THD *thd, bool allow_kill=true)
@@ -4548,6 +4583,17 @@ public:
inline Query_arena *activate_stmt_arena_if_needed(Query_arena *backup)
{
if (state == Query_arena::STMT_SP_QUERY_ARGUMENTS)
/*
Caller uses the arena with state STMT_SP_QUERY_ARGUMENTS for stored
routine's parameters. Lifetime of these objects spans a lifetime of
stored routine call and freed every time the stored routine execution
has been completed. That is the reason why switching to statement's
arena is not performed for arguments, else we would observe increasing
of memory usage while a stored routine be called over and over again.
*/
return NULL;
/*
Use the persistent arena if we are in a prepared statement or a stored
procedure statement and we have not already changed to use this arena.
@@ -5710,6 +5756,14 @@ public:
lex->analyze_stmt;
}
/* Return true if we should create a note when an unusable key is found */
bool give_notes_for_unusable_keys()
{
return ((variables.note_verbosity & (NOTE_VERBOSITY_UNUSABLE_KEYS)) ||
(lex->describe && // Is EXPLAIN
(variables.note_verbosity & NOTE_VERBOSITY_EXPLAIN)));
}
bool vers_insert_history_fast(const TABLE *table)
{
DBUG_ASSERT(table->versioned());