diff options
| author | unknown <knielsen@knielsen-hq.org> | 2013-12-05 14:36:09 +0100 |
|---|---|---|
| committer | unknown <knielsen@knielsen-hq.org> | 2013-12-05 14:36:09 +0100 |
| commit | 4d6ee2d1197c0e5ebecd019d6625d7d05bf1cab8 (patch) | |
| tree | b22b03c739c9d47e0c64ff489ae97c9041f1a5f2 /sql/sql_class.cc | |
| parent | 4bce09c104f5c9ddc3600a77c9db44dfa7fd283c (diff) | |
| download | mariadb-git-4d6ee2d1197c0e5ebecd019d6625d7d05bf1cab8.tar.gz | |
MDEV-5363: Make parallel replication waits killable
Make wait_for_prior_commit killable, and handle the error if
killed.
Diffstat (limited to 'sql/sql_class.cc')
| -rw-r--r-- | sql/sql_class.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d1edec140b6..1898bae1499 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5783,13 +5783,28 @@ wait_for_commit::register_wait_for_prior_commit(wait_for_commit *waitee) returns immediately. */ int -wait_for_commit::wait_for_prior_commit2() +wait_for_commit::wait_for_prior_commit2(THD *thd) { + const char *old_msg; + mysql_mutex_lock(&LOCK_wait_commit); - while (waiting_for_commit) + old_msg= thd->enter_cond(&COND_wait_commit, &LOCK_wait_commit, + "Waiting for prior transaction to commit"); + while (waiting_for_commit && !thd->check_killed()) mysql_cond_wait(&COND_wait_commit, &LOCK_wait_commit); - mysql_mutex_unlock(&LOCK_wait_commit); + thd->exit_cond(old_msg); waitee= NULL; + if (!waiting_for_commit) + { + if (wakeup_error) + my_error(ER_PRIOR_COMMIT_FAILED, MYF(0)); + return wakeup_error; + } + /* Wait was interrupted by kill, so give the error. */ + wakeup_error= thd->killed_errno(); + if (!wakeup_error) + wakeup_error= ER_QUERY_INTERRUPTED; + my_message(wakeup_error, ER(wakeup_error), MYF(0)); return wakeup_error; } |
