Merge 10.10 into 10.11

This commit is contained in:
Sergei Petrunia 2023-08-17 11:58:17 +03:00
commit 725bd56834
41 changed files with 1071 additions and 296 deletions

View file

@ -134,13 +134,12 @@ public:
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze)=0;
virtual void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl)= 0;
bool is_analyze)= 0;
int print_explain_for_children(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json_for_children(Explain_query *query,
Json_writer *writer, bool is_analyze,
bool no_tmp_tbl);
Json_writer *writer, bool is_analyze);
bool print_explain_json_cache(Json_writer *writer, bool is_analyze);
virtual ~Explain_node() = default;
};
@ -174,10 +173,10 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
void print_explain_json_interns(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
/* A flat array of Explain structs for tables. */
Explain_table_access** join_tabs;
@ -261,7 +260,7 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
Table_access_tracker *get_using_temporary_read_tracker()
{
@ -304,8 +303,7 @@ public:
Explain_aggr_filesort(MEM_ROOT *mem_root, bool is_analyze,
Filesort *filesort);
void print_json_members(Json_writer *writer, bool is_analyze,
bool no_tmp_tbl);
void print_json_members(Json_writer *writer, bool is_analyze);
};
class Explain_aggr_tmp_table : public Explain_aggr_node
@ -326,8 +324,7 @@ class Explain_aggr_window_funcs : public Explain_aggr_node
public:
enum_explain_aggr_node_type get_type() { return AGGR_OP_WINDOW_FUNCS; }
void print_json_members(Json_writer *writer, bool is_analyze,
bool no_tmp_tbl);
void print_json_members(Json_writer *writer, bool is_analyze);
friend class Window_funcs_computation;
};
@ -380,7 +377,7 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
const char *fake_select_type;
bool using_filesort;
@ -448,19 +445,19 @@ class Explain_insert;
(1) - Query plan construction is finished and it is available for reading.
(2) - Temporary tables are freed. After this point,
we need to pass QT_DONT_ACCESS_TMP_TABLES to item->print(). Since
we don't track when #2 happens for each temp.table, we pass this
flag whenever we're printing the query plan for a SHOW command.
Also, we pass it when printing ANALYZE (?)
(2) - Temporary tables are freed (with exception of derived tables
which are freed at step (4)).
The tables are no longer accessible but one can still call
item->print(), even for items that refer to temp.tables (see
Item_field::print() for details)
(3) - Notification about (4).
(4) - Tables used by the query are closed. One known consequence of this is
that the values of the const tables' fields are not available anymore.
We could use the same approach as in QT_DONT_ACCESS_TMP_TABLES to work
around that, but instead we disallow producing FORMAT=JSON output at
step #3. We also processing of SHOW command. The rationale is that
query is close to finish anyway.
(4) - Tables used by the query are closed. One consequence of this is that
the values of the const tables' fields are not available anymore.
We could adjust the code in Item_field::print() to handle this but
instead we make step (3) disallow production of FORMAT=JSON output.
We also disable processing of SHOW EXPLAIN|ANALYZE output because
the query is about to finish anyway.
(5) - Item objects are freed. After this, it's certainly not possible to
print them into FORMAT=JSON output.
@ -499,7 +496,6 @@ public:
bool print_explain_str(THD *thd, String *out_str, bool is_analyze);
int print_explain_json(select_result_sink *output, bool is_analyze,
bool is_show_cmd,
ulonglong query_time_in_progress_ms= 0);
/* If true, at least part of EXPLAIN can be printed */
@ -512,7 +508,7 @@ public:
Explain_update *get_upd_del_plan() { return upd_del_plan; }
private:
bool print_query_blocks_json(Json_writer *writer, const bool is_analyze, const bool is_show_cmd);
bool print_query_blocks_json(Json_writer *writer, const bool is_analyze);
void print_query_optimization_json(Json_writer *writer);
void send_explain_json_to_output(Json_writer *writer, select_result_sink *output);
@ -914,15 +910,14 @@ public:
uint select_id, const char *select_type,
bool using_temporary, bool using_filesort);
void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
private:
void append_tag_name(String *str, enum explain_extra_tag tag);
void fill_key_str(String *key_str, bool is_json) const;
void fill_key_len_str(String *key_len_str, bool is_json) const;
double get_r_filtered();
void tag_to_json(Json_writer *writer, enum explain_extra_tag tag,
bool no_tmp_tbl);
void tag_to_json(Json_writer *writer, enum explain_extra_tag tag);
};
@ -1009,7 +1004,7 @@ public:
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
virtual void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
};
@ -1035,7 +1030,7 @@ public:
int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
};
@ -1062,7 +1057,7 @@ public:
virtual int print_explain(Explain_query *query, select_result_sink *output,
uint8 explain_flags, bool is_analyze);
virtual void print_explain_json(Explain_query *query, Json_writer *writer,
bool is_analyze, bool no_tmp_tbl);
bool is_analyze);
};