From 798fcb541698cbf51f1ee33f44b023c11dc2b784 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 14 Jan 2017 20:55:33 +0100 Subject: bugfix: cmp_item_row::alloc_comparators() allocated on the wrong arena it used current_thd->alloc() and allocated on the thd's execution arena, not on table->expr_arena. Remove THD::arena_for_cached_items that is temporarily set in update_virtual_fields(), and replaces THD arena in get_datetime_value(). Instead set THD arena to table->expr_arena for the whole duration of update_virtual_fields() --- sql/sql_class.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 62339b2690a..93af4d3bb4d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -957,7 +957,6 @@ THD::THD() m_internal_handler= NULL; m_binlog_invoker= FALSE; - arena_for_cached_items= 0; memset(&invoker_user, 0, sizeof(invoker_user)); memset(&invoker_host, 0, sizeof(invoker_host)); prepare_derived_at_open= FALSE; -- cgit v1.2.1 From 7e2f9d092dd1fb6b0fa1a8fdd5d1f3af68b56f45 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 12 Dec 2016 01:01:56 +0100 Subject: max_session_mem_used server variable --- sql/sql_class.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sql/sql_class.cc') diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 4143d2cc419..c9592df1b65 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -906,8 +906,8 @@ THD::THD(bool is_wsrep_applier) #endif { ulong tmp; + bzero(&variables, sizeof(variables)); - mdl_context.init(this); /* We set THR_THD to temporally point to this THD to register all the variables that allocates memory for this THD @@ -916,8 +916,11 @@ THD::THD(bool is_wsrep_applier) set_current_thd(this); status_var.local_memory_used= sizeof(THD); status_var.global_memory_used= 0; + variables.max_mem_used= global_system_variables.max_mem_used; main_da.init(); + mdl_context.init(this); + /* Pass nominal parameters to init_alloc_root only to ensure that the destructor works OK in case of an error. The main_mem_root @@ -964,7 +967,6 @@ THD::THD(bool is_wsrep_applier) connection_name.str= 0; connection_name.length= 0; - bzero(&variables, sizeof(variables)); file_id = 0; query_id= 0; query_name_consts= 0; -- cgit v1.2.1