summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2000-10-02 17:59:12 -0600
committerunknown <sasha@mysql.sashanet.com>2000-10-02 17:59:12 -0600
commitf97de74c309b66f9fe6c215b4a55ff7099d963ca (patch)
tree9b9931ae732b32d93ebe974b9f01c6bd7f034abd /sql/sql_repl.cc
parenta9f2a439b4b9efd9a9490302774a6d4ae09fccbb (diff)
downloadmariadb-git-f97de74c309b66f9fe6c215b4a55ff7099d963ca.tar.gz
skip updates with the same server id as self
kill zombie COM_BINLOG_DUMP with the same server id on connect sql/mysql_priv.h: made kill_one_thread global scope sql/slave.cc: skip updates with the same server id as self fixed compiler warning sql/sql_parse.cc: COM_BINLOG_DUMP is followed by a simulation of COM_QUIT for proper thread clean up sql/sql_repl.cc: kill zombie COM_BINLOG_DUMP with the same server id on connect, more verbose binlog_send process status
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc35
1 files changed, 33 insertions, 2 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index fe51faa9dcb..1ee484b1bc1 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -225,6 +225,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
if(read_packet)
{
+ thd->proc_info = "sending update to slave";
if(my_net_write(net, (char*)packet->ptr(), packet->length()) )
{
errmsg = "Failed on my_net_write()";
@@ -257,7 +258,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
else
{
bool loop_breaker = 0; // need this to break out of the for loop from switch
-
+ thd->proc_info = "switching to next log";
switch(mysql_bin_log.find_next_log(&linfo))
{
case LOG_INFO_EOF:
@@ -307,10 +308,12 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
}
(void)my_fclose(log, MYF(MY_WME));
-
+
send_eof(&thd->net);
+ thd->proc_info = "waiting to finalize termination";
DBUG_VOID_RETURN;
err:
+ thd->proc_info = "waiting to finalize termination";
if(log)
(void) my_fclose(log, MYF(MY_WME));
send_error(&thd->net, 0, errmsg);
@@ -408,6 +411,34 @@ void reset_slave()
void kill_zombie_dump_threads(uint32 slave_server_id)
{
pthread_mutex_lock(&LOCK_thread_count);
+ I_List_iterator<THD> it(threads);
+ THD *tmp;
+
+ while((tmp=it++))
+ {
+ if(tmp->command == COM_BINLOG_DUMP &&
+ tmp->server_id == slave_server_id)
+ {
+ // here we do not call kill_one_thread()
+ // it will be slow because it will iterate through the list
+ // again. Plus it double-locks LOCK_thread_count, which
+ // make safe_mutex complain and abort
+ // so we just to our own thread murder
+
+ thr_alarm_kill(tmp->real_id);
+ tmp->killed = 1;
+ pthread_mutex_lock(&tmp->mysys_var->mutex);
+ tmp->mysys_var->abort = 1;
+ if(tmp->mysys_var->current_mutex)
+ {
+ pthread_mutex_lock(tmp->mysys_var->current_mutex);
+ pthread_cond_broadcast(tmp->mysys_var->current_cond);
+ pthread_mutex_unlock(tmp->mysys_var->current_mutex);
+ }
+ pthread_mutex_unlock(&tmp->mysys_var->mutex);
+ }
+ }
+
pthread_mutex_unlock(&LOCK_thread_count);
}