summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc45
1 files changed, 27 insertions, 18 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index cde5a431ec1..e1ff29e0b24 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/*
+ Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -11,7 +12,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
/*****************************************************************************
@@ -499,11 +501,11 @@ const char *set_thd_proc_info(THD *thd, const char *info,
thd= current_thd;
const char *old_info= thd->proc_info;
- const char *basename= calling_file ? base_name(calling_file) : NULL;
- DBUG_PRINT("proc_info", ("%s:%d %s", basename, calling_line, info));
+ DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, info));
#if defined(ENABLED_PROFILING)
- thd->profiling.status_change(info, calling_function, basename, calling_line);
+ thd->profiling.status_change(info,
+ calling_function, calling_file, calling_line);
#endif
thd->proc_info= info;
return old_info;
@@ -620,7 +622,7 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
{
String str(buffer, length, &my_charset_latin1);
const Security_context *sctx= &thd->main_security_ctx;
- char header[64];
+ char header[256];
int len;
/*
The pointers thd->query and thd->proc_info might change since they are
@@ -634,8 +636,8 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
const char *proc_info= thd->proc_info;
len= my_snprintf(header, sizeof(header),
- "MySQL thread id %lu, query id %lu",
- thd->thread_id, (ulong) thd->query_id);
+ "MySQL thread id %lu, OS thread handle 0x%lx, query id %lu",
+ thd->thread_id, (ulong) thd->real_id, (ulong) thd->query_id);
str.length(0);
str.append(header, len);
@@ -777,7 +779,6 @@ THD::THD()
is_slave_error= thread_specific_used= FALSE;
my_hash_clear(&handler_tables_hash);
tmp_table=0;
- used_tables=0;
cuted_fields= 0L;
sent_row_count= 0L;
limit_found_rows= 0;
@@ -4149,16 +4150,24 @@ void THD::set_mysys_var(struct st_my_thread_var *new_mysys_var)
void THD::leave_locked_tables_mode()
{
+ if (locked_tables_mode == LTM_LOCK_TABLES)
+ {
+ /*
+ When leaving LOCK TABLES mode we have to change the duration of most
+ of the metadata locks being held, except for HANDLER and GRL locks,
+ to transactional for them to be properly released at UNLOCK TABLES.
+ */
+ mdl_context.set_transaction_duration_for_all_locks();
+ /*
+ Make sure we don't release the global read lock and commit blocker
+ when leaving LTM.
+ */
+ global_read_lock.set_explicit_lock_duration(this);
+ /* Also ensure that we don't release metadata locks for open HANDLERs. */
+ if (handler_tables_hash.records)
+ mysql_ha_set_explicit_lock_duration(this);
+ }
locked_tables_mode= LTM_NONE;
- mdl_context.set_transaction_duration_for_all_locks();
- /*
- Make sure we don't release the global read lock and commit blocker
- when leaving LTM.
- */
- global_read_lock.set_explicit_lock_duration(this);
- /* Also ensure that we don't release metadata locks for open HANDLERs. */
- if (handler_tables_hash.records)
- mysql_ha_set_explicit_lock_duration(this);
}
void THD::get_definer(LEX_USER *definer)