summaryrefslogtreecommitdiff
path: root/sql/opt_trace.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-01-04 10:30:45 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-01-04 10:30:45 +0200
commitdaf4fa5238a67fcf47075721d86d4348adab687b (patch)
treefff85b8f2e11607c93d806e787475ad82f5055f6 /sql/opt_trace.cc
parent756568f26c6a23c537f4d93ff00f485c6291c92e (diff)
parent7dfaded9625e832fade4ef1678bcb21c445dad2b (diff)
downloadmariadb-git-st-10.8-merge.tar.gz
Merge 10.7 into 10.8st-10.8-merge
Diffstat (limited to 'sql/opt_trace.cc')
-rw-r--r--sql/opt_trace.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc
index ba9220cac44..4bc493940fb 100644
--- a/sql/opt_trace.cc
+++ b/sql/opt_trace.cc
@@ -471,12 +471,14 @@ void Opt_trace_context::end()
current_trace= NULL;
}
-Opt_trace_start::Opt_trace_start(THD *thd, TABLE_LIST *tbl,
- enum enum_sql_command sql_command,
- List<set_var_base> *set_vars,
- const char *query,
- size_t query_length,
- const CHARSET_INFO *query_charset):ctx(&thd->opt_trace)
+
+void Opt_trace_start::init(THD *thd,
+ TABLE_LIST *tbl,
+ enum enum_sql_command sql_command,
+ List<set_var_base> *set_vars,
+ const char *query,
+ size_t query_length,
+ const CHARSET_INFO *query_charset)
{
/*
if optimizer trace is enabled and the statment we have is traceable,
@@ -496,6 +498,9 @@ Opt_trace_start::Opt_trace_start(THD *thd, TABLE_LIST *tbl,
ctx->set_query(query, query_length, query_charset);
traceable= TRUE;
opt_trace_disable_if_no_tables_access(thd, tbl);
+ Json_writer *w= ctx->get_current_json();
+ w->start_object();
+ w->add_member("steps").start_array();
}
}
@@ -503,6 +508,9 @@ Opt_trace_start::~Opt_trace_start()
{
if (traceable)
{
+ Json_writer *w= ctx->get_current_json();
+ w->end_array();
+ w->end_object();
ctx->end();
traceable= FALSE;
}