diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-07-17 21:52:08 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-07-17 21:52:08 +0400 |
commit | 2368f8895d10a3d883a6a0ffe33b2b222caf7f1a (patch) | |
tree | 1f674b38702d87f5b13bbb587c8939bc842e9926 /sql/sql_class.cc | |
parent | a49b4c970fe582919d89109e0cc3ebe2558269cd (diff) | |
download | mariadb-git-2368f8895d10a3d883a6a0ffe33b2b222caf7f1a.tar.gz |
MWL#182: Explain running statements
- Address feedback from the second code review.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 414b1ba3f7f..d6e09b6c59a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2295,15 +2295,6 @@ int select_send::send_data(List<Item> &items) } -int select_result_explain_buffer::send_data(List<Item> &items) -{ - fill_record(thd, dst_table->field, items, TRUE, FALSE); - if ((dst_table->file->ha_write_tmp_row(dst_table->record[0]))) - return 1; - return 0; -} - - bool select_send::send_eof() { /* @@ -3233,43 +3224,6 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup) DBUG_VOID_RETURN; } - -/* - Produce EXPLAIN data. - - This function is APC-scheduled to be run in the context of the thread that - we're producing EXPLAIN for. -*/ - -void Show_explain_request::call_in_target_thread() -{ - Query_arena backup_arena; - bool printed_anything= FALSE; - - /* - Change the arena because JOIN::print_explain and co. are going to allocate - items. Let them allocate them on our arena. - */ - target_thd->set_n_backup_active_arena((Query_arena*)request_thd, - &backup_arena); - - query_str.copy(target_thd->query(), - target_thd->query_length(), - &my_charset_bin); - - if (target_thd->lex->unit.print_explain(explain_buf, 0 /* explain flags*/, - &printed_anything)) - { - failed_to_produce= TRUE; - } - - if (!printed_anything) - failed_to_produce= TRUE; - - target_thd->restore_active_arena((Query_arena*)request_thd, &backup_arena); -} - - Statement::~Statement() { } @@ -3832,6 +3786,7 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup) @retval 1 the user thread has been killed This is used to signal a storage engine if it should be killed. + See also THD::check_killed(). */ extern "C" int thd_killed(const MYSQL_THD thd) @@ -3839,6 +3794,10 @@ extern "C" int thd_killed(const MYSQL_THD thd) if (!thd) thd= current_thd; + 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)) return 0; return thd->killed; |