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
commitabb2aaa2792183168b11479a9b99d5d700667e1e (patch)
treea77300d361c4ea8556793f6c691e3b2812accf0c /sql/sql_repl.cc
parentaaf71625ea95f8163eb66a095ed00ea1953e3e7e (diff)
parent2b8614210d1db003a6827f301dad0321b1a7478e (diff)
downloadmariadb-git-abb2aaa2792183168b11479a9b99d5d700667e1e.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;