1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-28201: Server crashes upon SHOW ANALYZE/EXPLAIN FORMAT=JSON

- Describe the lifetime of EXPLAIN data structures in
  sql_explain.h:ExplainDataStructureLifetime.

- Make Item_field::set_field() call set_refers_to_temp_table()
  when it refers to a temp. table.
- Introduce QT_DONT_ACCESS_TMP_TABLES flag for Item::print.
  It directs Item_field::print to not try access its the
  temp table.
- Introduce Explain_query::notify_tables_are_closed()
  and call it right before the query closes its tables.
- Make Explain data stuctures' print_explain_json() methods
  accept "no_tmp_tbl" parameter which means pass
  QT_DONT_ACCESS_TMP_TABLES when printing items.
- Make Show_explain_request::call_in_target_thread() not call
  set_current_thd(). This wasn't needed as the code inside
  lex->print_explain() uses output->thd anyway. output->thd
  refers to the SHOW command's THD object.
This commit is contained in:
Sergei Petrunia
2022-04-04 12:32:22 +03:00
parent 02c3babdec
commit 3f68c2169e
22 changed files with 319 additions and 163 deletions

View File

@ -478,7 +478,7 @@ drop table if exists t0,t1,t2;
let $wait_condition= select State='show_explain_trap' from information_schema.processlist where id=$thr2;
connection con1;
set @show_explain_probe_query= 'SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency';
set debug_dbug='+d,log_slow_statement_end';
set debug_dbug='+d,explain_notify_tables_are_closed';
# Statement guarantees to produce 0 on every run
send SELECT count(*) - count(*) FROM sys.waits_by_user_by_latency;