summaryrefslogtreecommitdiff
path: root/vio/viopipe.c
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-07-28 15:59:38 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2020-07-30 10:17:45 +0200
commit71015d844e3f25a0c4eada9827a1dad464a4fdce (patch)
tree559fad43bb05477098b15df4476c5ccfd3135c0d /vio/viopipe.c
parent34f2be3b296fdd5933687eda9c3ef3ba9f707261 (diff)
downloadmariadb-git-71015d844e3f25a0c4eada9827a1dad464a4fdce.tar.gz
MDEV-21101 unexpected wait_timeout with pool-of-threads
Due to restricted size of the threadpool, execution of client queries can be delayed (queued) for a while. This delay was interpreted as client inactivity, and connection is closed, if client idle time + queue time exceeds wait_timeout. But users did not expect queue time to be included into wait_timeout. This patch changes the behavior. We don't close connection anymore, if there is some unread data present on connection, even if wait_timeout is exceeded. Unread data means that client was not idle, it sent a query, which we did not have time to process yet.
Diffstat (limited to 'vio/viopipe.c')
-rw-r--r--vio/viopipe.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vio/viopipe.c b/vio/viopipe.c
index 84643935c13..5007599aa17 100644
--- a/vio/viopipe.c
+++ b/vio/viopipe.c
@@ -141,5 +141,11 @@ int vio_close_pipe(Vio *vio)
DBUG_RETURN(ret);
}
+/* return number of bytes readable from pipe.*/
+uint vio_pending_pipe(Vio *vio)
+{
+ DWORD bytes;
+ return PeekNamedPipe(vio->hPipe, NULL, 0, NULL, &bytes, NULL) ? bytes : 0;
+}
#endif