summaryrefslogtreecommitdiff
path: root/sql/sql_repl.cc
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-08-15 15:57:47 -0600
committerunknown <sasha@mysql.sashanet.com>2001-08-15 15:57:47 -0600
commit63cb769ac4be8fbb8e5237c5fc1b698053198753 (patch)
treea77300d361c4ea8556793f6c691e3b2812accf0c /sql/sql_repl.cc
parentbe5c7e277cff699e141cd7e9b2d4ba5541ec9916 (diff)
parent169b74e63f7a1ea968bd722a995a5068104f4f64 (diff)
downloadmariadb-git-63cb769ac4be8fbb8e5237c5fc1b698053198753.tar.gz
merged replication fixes from 3.23
BitKeeper/etc/logging_ok: auto-union Docs/manual.texi: merged sql/mini_client.cc: merged sql/mysqld.cc: merged sql/sql_repl.cc: merged
Diffstat (limited to 'sql/sql_repl.cc')
-rw-r--r--sql/sql_repl.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index cda1a8531df..84a7bc7315a 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -688,8 +688,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;