1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

improvements for stopping the slave in SLAVE STOP and on shutdown

sql/mini_client.cc:
  alarm around mc_mysql_connect()
sql/mysqld.cc:
  move end_slave() to the earlier part of shutdown
sql/sql_repl.cc:
  retry thr_alarm_kill() in case slave thread missed the signal in SLAVE STOP
This commit is contained in:
unknown
2001-08-15 15:41:52 -06:00
parent acc79d65c6
commit 1f4334652f
3 changed files with 36 additions and 4 deletions

View File

@@ -610,8 +610,26 @@ 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";
while(slave_running)
pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
while(slave_running)
{
/* there is a small change that slave thread might miss the first
alarm. To protect againts it, resend the signal until it reacts
*/
struct timespec abstime;
#ifdef HAVE_TIMESPEC_TS_SEC
abstime.ts_sec=time(NULL)+2;
abstime.ts_nsec=0;
#else
struct timeval tv;
gettimeofday(&tv,0);
abstime.tv_sec=tv.tv_sec+2;
abstime.tv_nsec=tv.tv_usec*1000;
#endif
pthread_cond_timedwait(&COND_slave_stopped, &LOCK_slave, &abstime);
if (slave_running)
thr_alarm_kill(slave_real_id);
}
}
else
slave_errno = ER_SLAVE_NOT_RUNNING;