Minor cleanup in the optimizer trace code.

More test coverage added for the optimizer trace.
This commit is contained in:
Varun Gupta 2019-02-18 17:11:20 +05:30
commit 9cb55143ac
17 changed files with 3042 additions and 474 deletions

View file

@ -219,15 +219,15 @@ void Json_writer::add_str(const String &str)
add_str(str.ptr(), str.length());
}
Json_writer_object::Json_writer_object(THD *thd) :
Json_writer_object::Json_writer_object(THD *thd) :
Json_writer_struct(thd)
{
if (my_writer)
my_writer->start_object();
}
Json_writer_object::Json_writer_object(THD* thd, const char *str)
: Json_writer_struct(thd)
Json_writer_object::Json_writer_object(THD* thd, const char *str) :
Json_writer_struct(thd)
{
if (my_writer)
my_writer->add_member(str).start_object();
@ -247,8 +247,8 @@ Json_writer_array::Json_writer_array(THD *thd) :
my_writer->start_array();
}
Json_writer_array::Json_writer_array(THD *thd, const char *str)
:Json_writer_struct(thd)
Json_writer_array::Json_writer_array(THD *thd, const char *str) :
Json_writer_struct(thd)
{
if (my_writer)
my_writer->add_member(str).start_array();
@ -263,6 +263,16 @@ Json_writer_array::~Json_writer_array()
}
}
Json_writer_temp_disable::Json_writer_temp_disable(THD *thd_arg)
{
thd= thd_arg;
thd->opt_trace.disable_tracing_if_required();
}
Json_writer_temp_disable::~Json_writer_temp_disable()
{
thd->opt_trace.enable_tracing_if_required();
}
bool Single_line_formatting_helper::on_add_member(const char *name)
{
DBUG_ASSERT(state== INACTIVE || state == DISABLED);