diff options
author | unknown <aelkin/andrei@mysql1000.dsl.inet.fi> | 2008-02-14 13:55:11 +0200 |
---|---|---|
committer | unknown <aelkin/andrei@mysql1000.dsl.inet.fi> | 2008-02-14 13:55:11 +0200 |
commit | 8414bd54eab18564e5df438f3d672a8aafaf5c75 (patch) | |
tree | a3b56647eb62d559a5cab68b82aa0a86ac22ad2b /sql/slave.cc | |
parent | 269966ec36f5e50d1774fd440344d7783d3124ed (diff) | |
parent | ded528ca1249f35f55f9d7b52d95c96e94734495 (diff) | |
download | mariadb-git-8414bd54eab18564e5df438f3d672a8aafaf5c75.tar.gz |
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
sql/slave.cc:
Auto merged
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 8a3620080f2..181ad4ed8cb 100644 --- a/sql/slave.cc +++ b/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); |