diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-01 14:42:51 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-01 14:42:51 +0300 |
commit | 50a11f396af81aac6d5f51e8278ec9a7fa17e7c8 (patch) | |
tree | 1a695f030aa737b200e9271f9403971f8a571849 /sql/threadpool_common.cc | |
parent | 842da858b6c5b619bb5395ef4216f7e675b0f3a0 (diff) | |
parent | 9216114ce729733e6b0c4ce952bfdf57595ff387 (diff) | |
download | mariadb-git-50a11f396af81aac6d5f51e8278ec9a7fa17e7c8.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r-- | sql/threadpool_common.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index bd8573951b6..877428e67ac 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -451,11 +451,25 @@ void tp_timeout_handler(TP_connection *c) { if (c->state != TP_STATE_IDLE) return; - THD *thd=c->thd; + THD *thd= c->thd; mysql_mutex_lock(&thd->LOCK_thd_kill); - thd->set_killed_no_mutex(KILL_WAIT_TIMEOUT); - c->priority= TP_PRIORITY_HIGH; - post_kill_notification(thd); + Vio *vio= thd->net.vio; + if (vio && (vio_pending(vio) > 0 || vio->has_data(vio)) && + c->state == TP_STATE_IDLE) + { + /* + There is some data on that connection, i.e + i.e there was no inactivity timeout. + Don't kill. + */ + c->state= TP_STATE_PENDING; + } + else if (c->state == TP_STATE_IDLE) + { + thd->set_killed_no_mutex(KILL_WAIT_TIMEOUT); + c->priority= TP_PRIORITY_HIGH; + post_kill_notification(thd); + } mysql_mutex_unlock(&thd->LOCK_thd_kill); } |