summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-08-04 07:55:16 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-08-04 07:55:16 +0300
commit9a7948e3f6d3fd7528e49f43eb4d41f8f55c8a35 (patch)
tree68f8e54f6c2484dc7791bee8c594d3d07c611d29 /sql/threadpool_common.cc
parent56990b18d914b8150c9f777d134724d2b3390360 (diff)
parentbbd70fcc43cc889e4593594ee5ca436fe1433aac (diff)
downloadmariadb-git-9a7948e3f6d3fd7528e49f43eb4d41f8f55c8a35.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index c27f42b3d62..b26f41c6e9a 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -459,11 +459,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);
}