diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-06-19 19:25:15 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-06-19 19:25:15 -0400 |
commit | fc716dc5a5abd6997310256a1f846e39ea5bf312 (patch) | |
tree | 79fa59355e1ba3a5e315d0ead5a73c1880cc3388 /sql/mdl.cc | |
parent | 6050ab658696925f2a031b901eb398fff65fa92a (diff) | |
download | mariadb-git-fc716dc5a5abd6997310256a1f846e39ea5bf312.tar.gz |
MDEV-8260 : Issues related to concurrent CTAS
* Wait for aborted thd (victim) to release MDL locks
* Skip aborting an already aborted thd
* Defer setting OK status in case of CTAS
* Minor cosmetic changes
* Added a test case
Diffstat (limited to 'sql/mdl.cc')
-rw-r--r-- | sql/mdl.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc index 56f005d0eeb..5183a9806c9 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1199,6 +1199,13 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout, while (!m_wait_status && !thd->killed && wait_result != ETIMEDOUT && wait_result != ETIME) { +#ifdef WITH_WSREP + if (wsrep_thd_is_BF(thd, true)) + { + wait_result= mysql_cond_wait(&m_COND_wait_status, &m_LOCK_wait_status); + } + else +#endif wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status, abs_timeout); } @@ -1283,12 +1290,15 @@ void MDL_lock::Ticket_list::add_ticket(MDL_ticket *ticket) WSREP_DEBUG("MDL add_ticket inserted before: %lu %s", wsrep_thd_thread_id(waiting->get_ctx()->get_thd()), wsrep_thd_query(waiting->get_ctx()->get_thd())); + /* Insert the ticket before the first non-BF waiting thd. */ m_list.insert_after(prev, ticket); added= true; } prev= waiting; } - if (!added) m_list.push_back(ticket); + + /* Otherwise, insert the ticket at the back of the waiting list. */ + if (!added) m_list.push_back(ticket); while ((granted= itg++)) { |