summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <mkindahl@dl145h.mysql.com>2008-02-15 17:49:05 +0100
committerunknown <mkindahl@dl145h.mysql.com>2008-02-15 17:49:05 +0100
commit51cd734d8a5466823de37b7d7c682bd58fa16817 (patch)
tree4a0183d0989d27a9ad1226df52f45cf0c8a9532c /sql/slave.cc
parente05e6814fb2b48efccc9336252dc72f550a67169 (diff)
parente6a063cfd816e05958fa5f1bebd950d520493cf7 (diff)
downloadmariadb-git-51cd734d8a5466823de37b7d7c682bd58fa16817.tar.gz
Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl sql/sql_delete.cc: Auto merged sql/sql_update.cc: Auto merged BitKeeper/deleted/.del-rpl_variables.test: Manual merge. mysql-test/r/multi_update.result: Manual merge. mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Manual merge. sql/slave.cc: Manual merge.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index ea0dde942da..4f55d8f7cae 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1507,6 +1507,9 @@ void set_slave_thread_default_charset(THD* thd, Relay_log_info const *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();
@@ -1526,10 +1529,17 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd->thread_id= thd->variables.pseudo_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);
}
lex_start(thd);
@@ -2229,6 +2239,7 @@ pthread_handler_t handle_slave_io(void *arg)
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
@@ -2239,7 +2250,6 @@ pthread_handler_t handle_slave_io(void *arg)
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);
@@ -2530,9 +2540,11 @@ pthread_handler_t handle_slave_sql(void *arg)
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))
@@ -2547,7 +2559,6 @@ pthread_handler_t handle_slave_sql(void *arg)
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);
@@ -2560,7 +2571,6 @@ pthread_handler_t handle_slave_sql(void *arg)
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);