1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
mysql-test/mysql-test-run:
  fixed bug that unconditionally restarted both servers before each test
  added support for slave-master-info.opt to specify master info 
  options and override defaults for an individual test
  fixed race conditions in slave start/slave stop
  added a new rpl test case
sql/sql_repl.cc:
  fixed race conditions in slave start/slave stop
This commit is contained in:
unknown
2000-12-13 09:58:26 -07:00
parent 20da4f8884
commit a3d15c0fff
5 changed files with 84 additions and 20 deletions

View File

@ -515,7 +515,8 @@ int start_slave(THD* thd , bool net_report)
{
err = "cannot create slave thread";
}
pthread_cond_wait(&COND_slave_start, &LOCK_slave);
while(!slave_running) // slave might already be running by now
pthread_cond_wait(&COND_slave_start, &LOCK_slave);
}
else
err = "Master host not set, or server id not configured";
@ -552,7 +553,9 @@ int stop_slave(THD* thd, bool net_report )
// do not abort the slave in the middle of a query, so we do not set
// thd->killed for the slave thread
thd->proc_info = "waiting for slave to die";
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
while(slave_running) // we may miss slave start broadcast, if it starts
// very quickly
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
}
else
err = "Slave is not running";
@ -633,7 +636,8 @@ int change_master(THD* thd)
abort_slave = 1;
thr_alarm_kill(slave_real_id);
thd->proc_info = "waiting for slave to die";
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave); // wait until done
while(slave_running)
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave); // wait until done
}
pthread_mutex_unlock(&LOCK_slave);
thd->proc_info = "changing master";