Commit 7b81b641 authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-3982: show_explain.test fails, times out or crashes

Backport the fix from 10.0 tree

- The problem was that thd_killed() may be called by innodb from 
  an internal innodb thread.
- Fixed by not processing APC requests when we're not in the thread
  that owns the APC target.
parent 26b5351c
...@@ -3860,12 +3860,16 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup) ...@@ -3860,12 +3860,16 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup)
extern "C" int thd_killed(const MYSQL_THD thd) extern "C" int thd_killed(const MYSQL_THD thd)
{ {
THD* current= current_thd;
if (!thd) if (!thd)
thd= current_thd; thd= current_thd;
Apc_target *apc_target= (Apc_target*)&thd->apc_target; if (thd == current)
if (apc_target->have_apc_requests()) {
apc_target->process_apc_requests(); Apc_target *apc_target= (Apc_target*)&thd->apc_target;
if (apc_target->have_apc_requests())
apc_target->process_apc_requests();
}
if (!(thd->killed & KILL_HARD_BIT)) if (!(thd->killed & KILL_HARD_BIT))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment