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

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-03-18 17:07:32 +02:00
14 changed files with 70 additions and 24 deletions

View File

@@ -3,6 +3,8 @@
--echo # --echo #
source include/not_embedded.inc; source include/not_embedded.inc;
source include/not_windows.inc; source include/not_windows.inc;
# this would need an instrumented ncurses library
source include/not_msan.inc;
error 0,1; error 0,1;
exec $MYSQL -V|grep -q readline; exec $MYSQL -V|grep -q readline;

View File

@@ -37,7 +37,9 @@ connection con_temp1;
BEGIN; BEGIN;
INSERT INTO t2 VALUES (21); INSERT INTO t2 VALUES (21);
connection server_2; connection server_2;
START SLAVE; START SLAVE IO_THREAD;
include/wait_for_slave_param.inc [Read_Master_Log_Pos]
START SLAVE SQL_THREAD;
connection con_temp2; connection con_temp2;
SET @old_dbug= @@GLOBAL.debug_dbug; SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";

View File

@@ -37,7 +37,9 @@ connection con_temp1;
BEGIN; BEGIN;
INSERT INTO t2 VALUES (21); INSERT INTO t2 VALUES (21);
connection server_2; connection server_2;
START SLAVE; START SLAVE IO_THREAD;
include/wait_for_slave_param.inc [Read_Master_Log_Pos]
START SLAVE SQL_THREAD;
connection con_temp2; connection con_temp2;
SET @old_dbug= @@GLOBAL.debug_dbug; SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";

View File

@@ -57,6 +57,7 @@ COMMIT;
INSERT INTO t3 VALUES(21, 21); INSERT INTO t3 VALUES(21, 21);
INSERT INTO t3 VALUES(22, 22); INSERT INTO t3 VALUES(22, 22);
--save_master_pos --save_master_pos
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
# Start a connection that will block the replicated transaction halfway. # Start a connection that will block the replicated transaction halfway.
--connection con_temp1 --connection con_temp1
@@ -64,7 +65,27 @@ BEGIN;
INSERT INTO t2 VALUES (21); INSERT INTO t2 VALUES (21);
--connection server_2 --connection server_2
START SLAVE;
#
# Parallel replication will complete any in-progress event group at STOP SLAVE,
# but only if the event group is already queued up for the worker thread. If
# the SQL driver thread is delayed in queueing up events, the parallel worker
# thread can abort the event group, leaving the non-transactional update to the
# MyISAM table that cannot be rolled back (MDEV-7432). If this happens the test
# would fail with duplicate key error after slave restart.
#
# To avoid this, we here wait for the IO thread to read all master events, and
# for the SQL driver thread to queue all the events for workers. This wait
# should be removed if/when MDEV-7432 is fixed.
#
START SLAVE IO_THREAD;
--let $slave_param= Read_Master_Log_Pos
--let $slave_param_value= $master_pos
--source include/wait_for_slave_param.inc
START SLAVE SQL_THREAD;
--let $wait_condition= SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State LIKE '%Slave has read all relay log; waiting for more updates%'
--source include/wait_condition.inc
# Wait for the MyISAM change to be visible, after which replication will wait # Wait for the MyISAM change to be visible, after which replication will wait
# for con_temp1 to roll back. # for con_temp1 to roll back.
--let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20 --let $wait_condition= SELECT COUNT(*) = 1 FROM t1 WHERE a=20

View File

@@ -1152,7 +1152,7 @@ static bool debug_sync_eval_action(THD *thd, char *action_str, char *action_end)
st_debug_sync_action *action= NULL; st_debug_sync_action *action= NULL;
const char *errmsg; const char *errmsg;
char *ptr; char *ptr;
char *token; char *token= nullptr;
uint token_length= 0; uint token_length= 0;
DBUG_ENTER("debug_sync_eval_action"); DBUG_ENTER("debug_sync_eval_action");
DBUG_ASSERT(thd); DBUG_ASSERT(thd);

View File

@@ -89,7 +89,7 @@ public:
static void wrong_param_count_error(const LEX_CSTRING &schema_name, static void wrong_param_count_error(const LEX_CSTRING &schema_name,
const LEX_CSTRING &func_name); const LEX_CSTRING &func_name);
table_map not_null_tables_cache; table_map not_null_tables_cache= 0;
enum Functype { UNKNOWN_FUNC,EQ_FUNC,EQUAL_FUNC,NE_FUNC,LT_FUNC,LE_FUNC, enum Functype { UNKNOWN_FUNC,EQ_FUNC,EQUAL_FUNC,NE_FUNC,LT_FUNC,LE_FUNC,
GE_FUNC,GT_FUNC,FT_FUNC, GE_FUNC,GT_FUNC,FT_FUNC,

View File

@@ -426,6 +426,7 @@ struct wait_for_commit;
class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
{ {
#ifdef HAVE_PSI_INTERFACE
/** The instrumentation key to use for @ LOCK_index. */ /** The instrumentation key to use for @ LOCK_index. */
PSI_mutex_key m_key_LOCK_index; PSI_mutex_key m_key_LOCK_index;
/** The instrumentation key to use for @ COND_relay_log_updated */ /** The instrumentation key to use for @ COND_relay_log_updated */
@@ -440,6 +441,16 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
PSI_cond_key m_key_COND_queue_busy; PSI_cond_key m_key_COND_queue_busy;
/** The instrumentation key to use for LOCK_binlog_end_pos. */ /** The instrumentation key to use for LOCK_binlog_end_pos. */
PSI_mutex_key m_key_LOCK_binlog_end_pos; PSI_mutex_key m_key_LOCK_binlog_end_pos;
#else
static constexpr PSI_mutex_key m_key_LOCK_index= 0;
static constexpr PSI_cond_key m_key_relay_log_update= 0;
static constexpr PSI_cond_key m_key_bin_log_update= 0;
static constexpr PSI_file_key m_key_file_log= 0, m_key_file_log_cache= 0;
static constexpr PSI_file_key m_key_file_log_index= 0;
static constexpr PSI_file_key m_key_file_log_index_cache= 0;
static constexpr PSI_cond_key m_key_COND_queue_busy= 0;
static constexpr PSI_mutex_key m_key_LOCK_binlog_end_pos= 0;
#endif
struct group_commit_entry struct group_commit_entry
{ {

View File

@@ -556,10 +556,6 @@ class DsMrr_impl
public: public:
typedef void (handler::*range_check_toggle_func_t)(bool on); typedef void (handler::*range_check_toggle_func_t)(bool on);
DsMrr_impl()
: secondary_file(NULL),
rowid_filter(NULL) {};
void init(handler *h_arg, TABLE *table_arg) void init(handler *h_arg, TABLE *table_arg)
{ {
primary_file= h_arg; primary_file= h_arg;
@@ -581,7 +577,7 @@ public:
int dsmrr_explain_info(uint mrr_mode, char *str, size_t size); int dsmrr_explain_info(uint mrr_mode, char *str, size_t size);
private: private:
/* Buffer to store (key, range_id) pairs */ /* Buffer to store (key, range_id) pairs */
Lifo_buffer *key_buffer; Lifo_buffer *key_buffer= nullptr;
/* /*
The "owner" handler object (the one that is expected to "own" this object The "owner" handler object (the one that is expected to "own" this object
@@ -594,13 +590,13 @@ private:
Secondary handler object. (created when needed, we need it when we need Secondary handler object. (created when needed, we need it when we need
to run both index scan and rnd_pos() scan at the same time) to run both index scan and rnd_pos() scan at the same time)
*/ */
handler *secondary_file; handler *secondary_file= nullptr;
/* /*
The rowid filter that DS-MRR has "unpushed" from the storage engine. The rowid filter that DS-MRR has "unpushed" from the storage engine.
If it's present, DS-MRR will use it. If it's present, DS-MRR will use it.
*/ */
Rowid_filter *rowid_filter; Rowid_filter *rowid_filter= nullptr;
uint keyno; /* index we're running the scan on */ uint keyno; /* index we're running the scan on */
/* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */ /* TRUE <=> need range association, buffers hold {rowid, range_id} pairs */

View File

@@ -3278,7 +3278,7 @@ public:
Table_type table_type; /* Used for SHOW CREATE */ Table_type table_type; /* Used for SHOW CREATE */
List<Key_part_spec> ref_list; List<Key_part_spec> ref_list;
List<LEX_USER> users_list; List<LEX_USER> users_list;
List<Item> *insert_list,field_list,value_list,update_list; List<Item> *insert_list= nullptr,field_list,value_list,update_list;
List<List_item> many_values; List<List_item> many_values;
List<set_var_base> var_list; List<set_var_base> var_list;
List<set_var_base> stmt_var_list; //SET_STATEMENT values List<set_var_base> stmt_var_list; //SET_STATEMENT values

View File

@@ -76,7 +76,9 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
pthread_detach_this_thread(); pthread_detach_this_thread();
manager_thread = pthread_self(); manager_thread = pthread_self();
mysql_mutex_lock(&LOCK_manager); mysql_mutex_lock(&LOCK_manager);
while (!abort_manager) manager_thread_in_use = 1;
mysql_cond_signal(&COND_manager);
while (!abort_manager || cb_list)
{ {
/* XXX: This will need to be made more general to handle different /* XXX: This will need to be made more general to handle different
* polling needs. */ * polling needs. */
@@ -116,6 +118,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused)))
} }
mysql_mutex_lock(&LOCK_manager); mysql_mutex_lock(&LOCK_manager);
} }
DBUG_ASSERT(cb_list == NULL);
manager_thread_in_use = 0; manager_thread_in_use = 0;
mysql_mutex_unlock(&LOCK_manager); mysql_mutex_unlock(&LOCK_manager);
mysql_mutex_destroy(&LOCK_manager); mysql_mutex_destroy(&LOCK_manager);
@@ -135,12 +138,19 @@ void start_handle_manager()
pthread_t hThread; pthread_t hThread;
int err; int err;
DBUG_EXECUTE_IF("delay_start_handle_manager", my_sleep(1000);); DBUG_EXECUTE_IF("delay_start_handle_manager", my_sleep(1000););
manager_thread_in_use = 1;
mysql_cond_init(key_COND_manager, &COND_manager,NULL); mysql_cond_init(key_COND_manager, &COND_manager,NULL);
mysql_mutex_init(key_LOCK_manager, &LOCK_manager, NULL); mysql_mutex_init(key_LOCK_manager, &LOCK_manager, NULL);
if ((err= mysql_thread_create(key_thread_handle_manager, &hThread, if ((err= mysql_thread_create(key_thread_handle_manager, &hThread,
&connection_attrib, handle_manager, 0))) &connection_attrib, handle_manager, 0)))
{
sql_print_warning("Can't create handle_manager thread (errno: %M)", err); sql_print_warning("Can't create handle_manager thread (errno: %M)", err);
DBUG_VOID_RETURN;
}
mysql_mutex_lock(&LOCK_manager);
while (!manager_thread_in_use)
mysql_cond_wait(&COND_manager, &LOCK_manager);
mysql_mutex_unlock(&LOCK_manager);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@@ -77,6 +77,8 @@ struct set_numa_interleave_t
if (srv_numa_interleave) { if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed(); struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
MEM_MAKE_DEFINED(numa_mems_allowed,
sizeof *numa_mems_allowed);
ib::info() << "Setting NUMA memory policy to" ib::info() << "Setting NUMA memory policy to"
" MPOL_INTERLEAVE"; " MPOL_INTERLEAVE";
if (set_mempolicy(MPOL_INTERLEAVE, if (set_mempolicy(MPOL_INTERLEAVE,
@@ -874,6 +876,7 @@ inline bool buf_pool_t::chunk_t::create(size_t bytes)
if (srv_numa_interleave) if (srv_numa_interleave)
{ {
struct bitmask *numa_mems_allowed= numa_get_mems_allowed(); struct bitmask *numa_mems_allowed= numa_get_mems_allowed();
MEM_MAKE_DEFINED(numa_mems_allowed, sizeof *numa_mems_allowed);
if (mbind(mem, mem_size(), MPOL_INTERLEAVE, if (mbind(mem, mem_size(), MPOL_INTERLEAVE,
numa_mems_allowed->maskp, numa_mems_allowed->size, numa_mems_allowed->maskp, numa_mems_allowed->size,
MPOL_MF_MOVE)) MPOL_MF_MOVE))

View File

@@ -12284,7 +12284,7 @@ create_table_info_t::create_foreign_keys()
dict_index_t* index = NULL; dict_index_t* index = NULL;
fkerr_t index_error = FK_SUCCESS; fkerr_t index_error = FK_SUCCESS;
dict_index_t* err_index = NULL; dict_index_t* err_index = NULL;
ulint err_col; ulint err_col = 0;
const bool tmp_table = m_flags2 & DICT_TF2_TEMPORARY; const bool tmp_table = m_flags2 & DICT_TF2_TEMPORARY;
const CHARSET_INFO* cs = thd_charset(m_thd); const CHARSET_INFO* cs = thd_charset(m_thd);
const char* operation = "Create "; const char* operation = "Create ";
@@ -15482,7 +15482,6 @@ get_foreign_key_info(
char tmp_buff[NAME_LEN+1]; char tmp_buff[NAME_LEN+1];
char name_buff[NAME_LEN+1]; char name_buff[NAME_LEN+1];
const char* ptr; const char* ptr;
LEX_CSTRING* referenced_key_name;
LEX_CSTRING* name = NULL; LEX_CSTRING* name = NULL;
if (dict_table_t::is_temporary_name(foreign->foreign_table_name)) { if (dict_table_t::is_temporary_name(foreign->foreign_table_name)) {
@@ -15583,18 +15582,16 @@ get_foreign_key_info(
if (foreign->referenced_index if (foreign->referenced_index
&& foreign->referenced_index->name != NULL) { && foreign->referenced_index->name != NULL) {
referenced_key_name = thd_make_lex_string( f_key_info.referenced_key_name = thd_make_lex_string(
thd, thd,
f_key_info.referenced_key_name, nullptr,
foreign->referenced_index->name, foreign->referenced_index->name,
strlen(foreign->referenced_index->name), strlen(foreign->referenced_index->name),
1); 1);
} else { } else {
referenced_key_name = NULL; f_key_info.referenced_key_name = NULL;
} }
f_key_info.referenced_key_name = referenced_key_name;
pf_key_info = (FOREIGN_KEY_INFO*) thd_memdup(thd, &f_key_info, pf_key_info = (FOREIGN_KEY_INFO*) thd_memdup(thd, &f_key_info,
sizeof(FOREIGN_KEY_INFO)); sizeof(FOREIGN_KEY_INFO));

View File

@@ -287,6 +287,8 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
uchar *end= (uchar*) query + len; uchar *end= (uchar*) query + len;
FT_WORD w; FT_WORD w;
w.pos= NULL;
w.len= 0;
info.prev= ' '; info.prev= ' ';
info.quot= 0; info.quot= 0;
while (ft_get_word(cs, start, end, &w, &info)) while (ft_get_word(cs, start, end, &w, &info))

View File

@@ -3842,7 +3842,7 @@ static void test_bind_result_ext1()
short i_data; short i_data;
uchar b_data; uchar b_data;
int f_data; int f_data;
long bData; int bData;
char d_data[20]; char d_data[20];
double szData; double szData;
MYSQL_BIND my_bind[8]; MYSQL_BIND my_bind[8];
@@ -3938,7 +3938,7 @@ static void test_bind_result_ext1()
fprintf(stdout, "\n data (float) : %d(%lu)", f_data, length[4]); fprintf(stdout, "\n data (float) : %d(%lu)", f_data, length[4]);
fprintf(stdout, "\n data (double) : %s(%lu)", d_data, length[5]); fprintf(stdout, "\n data (double) : %s(%lu)", d_data, length[5]);
fprintf(stdout, "\n data (bin) : %ld(%lu)", bData, length[6]); fprintf(stdout, "\n data (bin) : %d(%lu)", bData, length[6]);
fprintf(stdout, "\n data (str) : %g(%lu)", szData, length[7]); fprintf(stdout, "\n data (str) : %g(%lu)", szData, length[7]);
} }