summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-07-31 18:09:08 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-07-31 18:09:08 +0300
commit9216114ce729733e6b0c4ce952bfdf57595ff387 (patch)
tree7a541ed87a6a8174d3d94c5f780724a34e08dc1c /sql/threadpool_common.cc
parentdc513dff911d72eaaf9f752f390fef8d1ef9a4b0 (diff)
parent66ec3a770f7854f500ece66c78f3c87c9cd6da15 (diff)
downloadmariadb-git-9216114ce729733e6b0c4ce952bfdf57595ff387.tar.gz
Merge 10.3 into 10.4
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 3a0c7a8514c..00c28be6f9b 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -475,11 +475,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);
}