mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into mysql1000.dsl.inet.fi:/home/andrei/MySQL/MERGE/5.0-bug33931-assert_write_ignored_ev_when_init_slave_fails
This commit is contained in:
commit
f5fe34dcd1
4 changed files with 90 additions and 4 deletions
38
mysql-test/r/rpl_bug33931.result
Normal file
38
mysql-test/r/rpl_bug33931.result
Normal file
|
@ -0,0 +1,38 @@
|
|||
reset master;
|
||||
stop slave;
|
||||
reset slave;
|
||||
start slave;
|
||||
show slave status;
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File
|
||||
Read_Master_Log_Pos 4
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File
|
||||
Slave_IO_Running No
|
||||
Slave_SQL_Running No
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 0
|
||||
Last_Error
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos 0
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
1
mysql-test/t/rpl_bug33931-slave.opt
Normal file
1
mysql-test/t/rpl_bug33931-slave.opt
Normal file
|
@ -0,0 +1 @@
|
|||
--loose-debug=d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init
|
37
mysql-test/t/rpl_bug33931.test
Normal file
37
mysql-test/t/rpl_bug33931.test
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Test for
|
||||
# Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails
|
||||
# Bug #33932 assertion at handle_slave_sql if init_slave_thread() fails
|
||||
|
||||
source include/have_debug.inc;
|
||||
source include/have_log_bin.inc;
|
||||
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
|
||||
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
|
||||
connection slave;
|
||||
--disable_warnings
|
||||
stop slave;
|
||||
--enable_warnings
|
||||
reset slave;
|
||||
start slave;
|
||||
|
||||
connection master;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
|
||||
#
|
||||
# slave is going to stop because of emulated failures
|
||||
# but there won't be any crashes nor asserts hit.
|
||||
#
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 8 # 9 # 23 # 33 #
|
||||
query_vertical show slave status;
|
||||
|
||||
# no clean-up is needed
|
||||
|
18
sql/slave.cc
18
sql/slave.cc
|
@ -2896,6 +2896,9 @@ void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli)
|
|||
static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
||||
{
|
||||
DBUG_ENTER("init_slave_thread");
|
||||
#if !defined(DBUG_OFF)
|
||||
int simulate_error= 0;
|
||||
#endif
|
||||
thd->system_thread = (thd_type == SLAVE_THD_SQL) ?
|
||||
SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO;
|
||||
thd->security_ctx->skip_grants();
|
||||
|
@ -2915,10 +2918,17 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
|||
thd->thread_id = thread_id++;
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
||||
DBUG_EXECUTE_IF("simulate_io_slave_error_on_init",
|
||||
simulate_error|= (1 << SLAVE_THD_IO););
|
||||
DBUG_EXECUTE_IF("simulate_sql_slave_error_on_init",
|
||||
simulate_error|= (1 << SLAVE_THD_SQL););
|
||||
#if !defined(DBUG_OFF)
|
||||
if (init_thr_lock() || thd->store_globals() || simulate_error & (1<< thd_type))
|
||||
#else
|
||||
if (init_thr_lock() || thd->store_globals())
|
||||
#endif
|
||||
{
|
||||
thd->cleanup();
|
||||
delete thd;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
@ -3516,6 +3526,7 @@ slave_begin:
|
|||
|
||||
thd= new THD; // note that contructor of THD uses DBUG_ !
|
||||
THD_CHECK_SENTRY(thd);
|
||||
mi->io_thd = thd;
|
||||
|
||||
pthread_detach_this_thread();
|
||||
thd->thread_stack= (char*) &thd; // remember where our stack is
|
||||
|
@ -3526,7 +3537,6 @@ slave_begin:
|
|||
sql_print_error("Failed during slave I/O thread initialization");
|
||||
goto err;
|
||||
}
|
||||
mi->io_thd = thd;
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
threads.append(thd);
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
|
@ -3866,9 +3876,11 @@ slave_begin:
|
|||
|
||||
thd = new THD; // note that contructor of THD uses DBUG_ !
|
||||
thd->thread_stack = (char*)&thd; // remember where our stack is
|
||||
rli->sql_thd= thd;
|
||||
|
||||
/* Inform waiting threads that slave has started */
|
||||
rli->slave_run_id++;
|
||||
rli->slave_running = 1;
|
||||
|
||||
pthread_detach_this_thread();
|
||||
if (init_slave_thread(thd, SLAVE_THD_SQL))
|
||||
|
@ -3883,7 +3895,6 @@ slave_begin:
|
|||
goto err;
|
||||
}
|
||||
thd->init_for_queries();
|
||||
rli->sql_thd= thd;
|
||||
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
|
||||
pthread_mutex_lock(&LOCK_thread_count);
|
||||
threads.append(thd);
|
||||
|
@ -3896,7 +3907,6 @@ slave_begin:
|
|||
start receiving data so we realize we are not caught up and
|
||||
Seconds_Behind_Master grows. No big deal.
|
||||
*/
|
||||
rli->slave_running = 1;
|
||||
rli->abort_slave = 0;
|
||||
pthread_mutex_unlock(&rli->run_lock);
|
||||
pthread_cond_broadcast(&rli->start_cond);
|
||||
|
|
Loading…
Reference in a new issue