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

Merge 10.11 into 11.4

This commit is contained in:
Marko Mäkelä
2024-12-02 11:35:34 +02:00
420 changed files with 6452 additions and 4162 deletions

View File

@@ -87,15 +87,17 @@ char empty_c_string[1]= {0}; /* used for not defined db */
** User variables
****************************************************************************/
extern "C" uchar *get_var_key(user_var_entry *entry, size_t *length,
my_bool not_used __attribute__((unused)))
extern "C" const uchar *get_var_key(const void *entry_, size_t *length,
my_bool)
{
auto entry= static_cast<const user_var_entry *>(entry_);
*length= entry->name.length;
return (uchar*) entry->name.str;
return reinterpret_cast<const uchar *>(entry->name.str);
}
extern "C" void free_user_var(user_var_entry *entry)
extern "C" void free_user_var(void *entry_)
{
user_var_entry *entry= static_cast<user_var_entry *>(entry_);
char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry));
if (entry->value && entry->value != pos)
my_free(entry->value);
@@ -104,18 +106,17 @@ extern "C" void free_user_var(user_var_entry *entry)
/* Functions for last-value-from-sequence hash */
extern "C" uchar *get_sequence_last_key(SEQUENCE_LAST_VALUE *entry,
size_t *length,
my_bool not_used
__attribute__((unused)))
extern "C" const uchar *get_sequence_last_key(const void *entry_,
size_t *length, my_bool)
{
auto *entry= static_cast<const SEQUENCE_LAST_VALUE *>(entry_);
*length= entry->length;
return (uchar*) entry->key;
return entry->key;
}
extern "C" void free_sequence_last(SEQUENCE_LAST_VALUE *entry)
extern "C" void free_sequence_last(void *entry)
{
delete entry;
delete static_cast<SEQUENCE_LAST_VALUE *>(entry);
}
@@ -620,8 +621,9 @@ handle_condition(THD *thd,
timeouts at end of query (and thus before THD is destroyed)
*/
extern "C" void thd_kill_timeout(THD* thd)
extern "C" void thd_kill_timeout(void *thd_)
{
THD *thd= static_cast<THD *>(thd_);
thd->status_var.max_statement_time_exceeded++;
/* Kill queries that can't cause data corruptions */
thd->awake(KILL_TIMEOUT);
@@ -912,12 +914,11 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
#endif
user_connect=(USER_CONN *)0;
my_hash_init(key_memory_user_var_entry, &user_vars, system_charset_info,
USER_VARS_HASH_SIZE, 0, 0, (my_hash_get_key) get_var_key,
(my_hash_free_key) free_user_var, HASH_THREAD_SPECIFIC);
my_hash_init(PSI_INSTRUMENT_ME, &sequences, Lex_ident_fs::charset_info(),
SEQUENCES_HASH_SIZE, 0, 0, (my_hash_get_key)
get_sequence_last_key, (my_hash_free_key) free_sequence_last,
USER_VARS_HASH_SIZE, 0, 0, get_var_key, free_user_var,
HASH_THREAD_SPECIFIC);
my_hash_init(PSI_INSTRUMENT_ME, &sequences, Lex_ident_fs::charset_info(),
SEQUENCES_HASH_SIZE, 0, 0, get_sequence_last_key,
free_sequence_last, HASH_THREAD_SPECIFIC);
/* For user vars replication*/
if (opt_bin_log)
@@ -1549,12 +1550,11 @@ void THD::change_user(void)
init();
stmt_map.reset();
my_hash_init(key_memory_user_var_entry, &user_vars, system_charset_info,
USER_VARS_HASH_SIZE, 0, 0, (my_hash_get_key) get_var_key,
(my_hash_free_key) free_user_var, HASH_THREAD_SPECIFIC);
USER_VARS_HASH_SIZE, 0, 0, get_var_key, free_user_var,
HASH_THREAD_SPECIFIC);
my_hash_init(key_memory_user_var_entry, &sequences,
Lex_ident_fs::charset_info(),
SEQUENCES_HASH_SIZE, 0, 0, (my_hash_get_key)
get_sequence_last_key, (my_hash_free_key) free_sequence_last,
Lex_ident_fs::charset_info(), SEQUENCES_HASH_SIZE, 0, 0,
get_sequence_last_key, free_sequence_last,
HASH_THREAD_SPECIFIC);
sp_caches_clear();
opt_trace.delete_traces();
@@ -4225,13 +4225,12 @@ Statement::~Statement() = default;
C_MODE_START
static uchar *
get_statement_id_as_hash_key(const uchar *record, size_t *key_length,
my_bool not_used __attribute__((unused)))
static const uchar *get_statement_id_as_hash_key(const void *record,
size_t *key_length, my_bool)
{
const Statement *statement= (const Statement *) record;
auto statement= static_cast<const Statement *>(record);
*key_length= sizeof(statement->id);
return (uchar *) &((const Statement *) statement)->id;
return reinterpret_cast<const uchar *>(&(statement)->id);
}
static void delete_statement_as_hash_key(void *key)
@@ -4239,11 +4238,12 @@ static void delete_statement_as_hash_key(void *key)
delete (Statement *) key;
}
static uchar *get_stmt_name_hash_key(Statement *entry, size_t *length,
my_bool not_used __attribute__((unused)))
static const uchar *get_stmt_name_hash_key(const void *entry_, size_t *length,
my_bool)
{
auto entry= static_cast<const Statement *>(entry_);
*length= entry->name.length;
return (uchar*) entry->name.str;
return reinterpret_cast<const uchar *>(entry->name.str);
}
C_MODE_END
@@ -4259,9 +4259,9 @@ Statement_map::Statement_map() :
my_hash_init(key_memory_prepared_statement_map, &st_hash, &my_charset_bin,
START_STMT_HASH_SIZE, 0, 0, get_statement_id_as_hash_key,
delete_statement_as_hash_key, MYF(0));
my_hash_init(key_memory_prepared_statement_map, &names_hash, system_charset_info, START_NAME_HASH_SIZE, 0, 0,
(my_hash_get_key) get_stmt_name_hash_key,
NULL, MYF(0));
my_hash_init(key_memory_prepared_statement_map, &names_hash,
system_charset_info, START_NAME_HASH_SIZE, 0, 0,
get_stmt_name_hash_key, NULL, MYF(0));
}
@@ -5321,10 +5321,11 @@ extern "C" MYSQL_THD thd_increment_pending_ops(MYSQL_THD thd)
end of async operation (such as end of group commit
write flush)
@param thd THD
@param thd_ THD
*/
extern "C" void thd_decrement_pending_ops(MYSQL_THD thd)
extern "C" void thd_decrement_pending_ops(void *thd_)
{
THD *thd= static_cast<THD*>(thd_);
DBUG_ASSERT(thd);
DBUG_ASSERT(thd->system_thread == NON_SYSTEM_THREAD);