diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-01 11:33:45 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-01 11:33:45 +0300 |
commit | 4e1fa7f63da580c1e0e4256bc4af3c02cdc51939 (patch) | |
tree | 6ac1589c98dbf15a465365f4f16a09da51ea8c48 /sql/threadpool_common.cc | |
parent | ff81faf670e083e1da4f3e7bce33fe9104410b2c (diff) | |
parent | 2f3968d98f8d90a9a9747e5b89c8f07efc6732e8 (diff) | |
download | mariadb-git-4e1fa7f63da580c1e0e4256bc4af3c02cdc51939.tar.gz |
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r-- | sql/threadpool_common.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index b6e7d0818a5..486a829c645 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -308,6 +308,24 @@ static void threadpool_remove_connection(THD *thd) my_thread_end(); } + +/* + Ensure that proper error message is sent to client, + and "aborted" message appears in the log in case of + wait timeout. + + See also timeout handling in net_serv.cc +*/ +static void handle_wait_timeout(THD *thd) +{ + thd->get_stmt_da()->reset_diagnostics_area(); + thd->reset_killed(); + my_error(ER_NET_READ_INTERRUPTED, MYF(0)); + thd->net.last_errno= ER_NET_READ_INTERRUPTED; + thd->net.error= 2; +} + + /** Process a single client request or a single batch. */ @@ -323,6 +341,8 @@ static int threadpool_process_request(THD *thd) or KILL command. Return error. */ retval= 1; + if(thd->killed == KILL_WAIT_TIMEOUT) + handle_wait_timeout(thd); goto end; } @@ -458,7 +478,7 @@ void tp_timeout_handler(TP_connection *c) return; THD *thd=c->thd; mysql_mutex_lock(&thd->LOCK_thd_data); - thd->killed= KILL_CONNECTION; + thd->set_killed(KILL_WAIT_TIMEOUT); c->priority= TP_PRIORITY_HIGH; post_kill_notification(thd); mysql_mutex_unlock(&thd->LOCK_thd_data); |