summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-05-10 23:19:05 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-05-10 23:53:12 +0400
commit8f7b5a0675b3735957eb676ee893002eb7c894cd (patch)
treea17c24cfd12b6cbb40ab03472f3d6e600d04e10f
parent9d431a0d961ff12f39ae8f24c0be44a0b08c5d7a (diff)
downloadmariadb-git-bb-10.5-svoj-MDEV-19439.tar.gz
MDEV-19439 - Revert orig_thd hackbb-10.5-svoj-MDEV-19439
This patch is to be squashed with previous one when MDEV-19439 is fixed. Causes assertion failurs currently.
-rw-r--r--sql/sql_class.cc19
-rw-r--r--sql/sql_class.h1
2 files changed, 3 insertions, 17 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7eff14cd715..5383e8d4b5f 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -605,11 +605,7 @@ THD_count::THD_count()
{
THD *thd= static_cast<THD*>(this);
thread_count++;
- /*
- We set THR_THD to temporally point to this THD to register all the
- variables that allocates memory for this THD
- */
- orig_thd= current_thd;
+ DBUG_ASSERT(!current_thd);
set_current_thd(thd);
thd->status_var.local_memory_used= sizeof(THD);
thd->status_var.max_local_memory_used= thd->status_var.local_memory_used;
@@ -632,7 +628,8 @@ THD_count::~THD_count()
!debug_assert_on_not_freed_memory);
}
update_global_memory_status(thd->status_var.global_memory_used);
- set_current_thd(orig_thd);
+ DBUG_ASSERT(current_thd == thd);
+ set_current_thd(0);
thread_count--;
}
@@ -894,7 +891,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
force_read_stats= FALSE;
save_prep_leaf_list= FALSE;
org_charset= 0;
- set_current_thd(orig_thd);
}
@@ -1680,15 +1676,6 @@ THD::~THD()
/* Make sure threads are not available via server_threads. */
assert_not_linked();
- /*
- In error cases, thd may not be current thd. We have to fix this so
- that memory allocation counting is done correctly
- */
- orig_thd= current_thd;
- if (orig_thd == this)
- orig_thd= 0;
- else
- set_current_thd(this);
if (!status_in_global)
add_status_to_global();
diff --git a/sql/sql_class.h b/sql/sql_class.h
index ffdbacd5a58..de471b96eae 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2134,7 +2134,6 @@ extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
*/
class THD_count
{
- THD *orig_thd;
THD_count();
~THD_count();
friend class THD;