diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2012-11-02 10:43:52 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2012-11-02 10:43:52 +0100 |
commit | 4ffc9c3b01459a2904a7154a6c750d128864fc7b (patch) | |
tree | d482bfdf461dc06616cfb23b61c1045a04b1b15d /sql/scheduler.cc | |
parent | 27bcea09e5230757071d27b91402647a9e0b4713 (diff) | |
download | mariadb-git-4ffc9c3b01459a2904a7154a6c750d128864fc7b.tar.gz |
MDEV-531 : Warning: Forcing close of thread ... in rpl_binlog_index
Use post_kill_notification in for one_thread_per_connection scheduler,
the same as already used in threadpool, to reliably wake a thread stuck in
read() or in different poll() variations.
Diffstat (limited to 'sql/scheduler.cc')
-rw-r--r-- | sql/scheduler.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/scheduler.cc b/sql/scheduler.cc index 78a1a2a32bb..0ae4121ef4c 100644 --- a/sql/scheduler.cc +++ b/sql/scheduler.cc @@ -79,11 +79,34 @@ void scheduler_init() { scheduler_wait_sync_end); } + +/** + Kill notification callback, used by one-thread-per-connection + and threadpool scheduler. + + Wakes up a thread that is stuck in read/poll/epoll/event-poll + routines used by threadpool, such that subsequent attempt to + read from client connection will result in IO error. +*/ + +void post_kill_notification(THD *thd) +{ + DBUG_ENTER("post_kill_notification"); + if (current_thd == thd || thd->system_thread) + DBUG_VOID_RETURN; + + if (thd->net.vio) + vio_shutdown(thd->net.vio, SHUT_RD); + DBUG_VOID_RETURN; +} + /* Initialize scheduler for --thread-handling=one-thread-per-connection */ #ifndef EMBEDDED_LIBRARY + + void one_thread_per_connection_scheduler(scheduler_functions *func, ulong *arg_max_connections, uint *arg_connection_count) @@ -95,6 +118,7 @@ void one_thread_per_connection_scheduler(scheduler_functions *func, func->init_new_connection_thread= init_new_connection_handler_thread; func->add_connection= create_thread_to_handle_connection; func->end_thread= one_thread_per_connection_end; + func->post_kill_notification= post_kill_notification; } #endif |