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

replication updates. This changeset seems to be working fine on test systems.

If no problems are discovered in the next week, this will make the replication
code ready for 4.0.2 release.


dbug/dbug.c:
  cleanup of my previous fix
sql/mysqld.cc:
  fixed a REALLY NASTY BUG - slave threads were being launched before 
  initialization of global thread keys. Thus if the slave thread was slow
  to start everything worked fine, but if it started quickly, we would get
  into trouble using the unitinialized keys
sql/net_pkg.cc:
  make net_printf() work with 0 error code taking the third argument as 
  format string in that case
sql/slave.cc:
  misc fix-ups and debugging instrumentations
sql/slave.h:
  added skip_log_purge member
sql/sql_class.cc:
  debugging instrumentation to track down random memory corruption
sql/sql_class.h:
  added debugging sentry to THD to track down memory corruption
sql/sql_repl.cc:
  fixed bugs in CHANGE MASTER
This commit is contained in:
unknown
2002-03-30 12:36:05 -07:00
parent ef261914d3
commit 5449b03bc8
8 changed files with 131 additions and 66 deletions

View File

@@ -714,7 +714,10 @@ int change_master(THD* thd, MASTER_INFO* mi)
return 1;
}
pthread_mutex_lock(&mi->data_lock);
/* data lock not needed since we have already stopped the running threads,
and we have the hold on the run locks which will keep all threads that
could possibly modify the data structures from running
*/
if ((lex_mi->host || lex_mi->port) && !lex_mi->log_file_name && !lex_mi->pos)
{
// if we change host or port, we must reset the postion
@@ -746,6 +749,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
if (lex_mi->relay_log_name)
{
need_relay_log_purge = 0;
mi->rli.skip_log_purge=1;
strnmov(mi->rli.relay_log_name,lex_mi->relay_log_name,
sizeof(mi->rli.relay_log_name));
}
@@ -759,16 +763,14 @@ int change_master(THD* thd, MASTER_INFO* mi)
flush_master_info(mi);
if (need_relay_log_purge)
{
pthread_mutex_unlock(&mi->data_lock);
mi->rli.skip_log_purge=0;
thd->proc_info="purging old relay logs";
if (purge_relay_logs(&mi->rli,0 /* not only reset, but also reinit*/,
&errmsg))
{
send_error(&thd->net, 0, "Failed purging old relay logs");
unlock_slave_threads(mi);
net_printf(&thd->net, 0, "Failed purging old relay logs: %s",errmsg);
return 1;
}
pthread_mutex_lock(&mi->rli.data_lock);
}
else
{
@@ -778,6 +780,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
0 /*no data lock*/,
&msg))
{
//Sasha: note that I had to change net_printf() to make this work
net_printf(&thd->net,0,"Failed initializing relay log position: %s",msg);
unlock_slave_threads(mi);
return 1;
@@ -789,7 +792,10 @@ int change_master(THD* thd, MASTER_INFO* mi)
sizeof(mi->rli.master_log_name));
if (!mi->rli.master_log_name[0]) // uninitialized case
mi->rli.master_log_pos=0;
pthread_cond_broadcast(&mi->rli.data_cond);
pthread_mutex_lock(&mi->rli.data_lock);
mi->rli.abort_pos_wait = 1;
pthread_cond_broadcast(&mi->data_cond);
pthread_mutex_unlock(&mi->rli.data_lock);
thd->proc_info = "starting slave";