#At file:///mnt/sda7/work/mysql-trunk-merge/ based on revid:alexey.kopytov@stripped
2938 Gleb Shchepa 2009-12-04 [merge]
manual merge mysql-5.1-bugteam --> mysql-trunk-merge
modified:
sql/sql_class.cc
storage/innobase/handler/ha_innodb.cc
storage/innobase/include/ha_prototypes.h
storage/innobase/include/trx0trx.h
storage/innobase/lock/lock0lock.c
storage/innobase/trx/trx0i_s.c
storage/innobase/trx/trx0trx.c
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2009-11-01 23:13:11 +0000
+++ b/sql/sql_class.cc 2009-12-01 10:38:40 +0000
@@ -376,6 +376,8 @@ char *thd_security_context(THD *thd, cha
str.append(proc_info);
}
+ pthread_mutex_lock(&thd->LOCK_thd_data);
+
if (thd->query())
{
if (max_query_len < 1)
@@ -385,6 +387,9 @@ char *thd_security_context(THD *thd, cha
str.append('\n');
str.append(thd->query(), len);
}
+
+ pthread_mutex_unlock(&thd->LOCK_thd_data);
+
if (str.c_ptr_safe() == buffer)
return buffer;
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2009-12-02 14:00:50 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2009-12-04 10:20:18 +0000
@@ -899,36 +899,6 @@ convert_error_code_to_mysql(
}
/*************************************************************//**
-If you want to print a thd that is not associated with the current thread,
-you must call this function before reserving the InnoDB kernel_mutex, to
-protect MySQL from setting thd->query NULL. If you print a thd of the current
-thread, we know that MySQL cannot modify thd->query, and it is not necessary
-to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release
-the kernel_mutex. */
-extern "C" UNIV_INTERN
-void
-innobase_mysql_prepare_print_arbitrary_thd(void)
-/*============================================*/
-{
- ut_ad(!mutex_own(&kernel_mutex));
- VOID(pthread_mutex_lock(&LOCK_thread_count));
-}
-
-/*************************************************************//**
-Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
-In the InnoDB latching order, the mutex sits right above the
-kernel_mutex. In debug builds, we assert that the kernel_mutex is
-released before this function is invoked. */
-extern "C" UNIV_INTERN
-void
-innobase_mysql_end_print_arbitrary_thd(void)
-/*========================================*/
-{
- ut_ad(!mutex_own(&kernel_mutex));
- VOID(pthread_mutex_unlock(&LOCK_thread_count));
-}
-
-/*************************************************************//**
Prints info of a THD object (== user session thread) to the given file. */
extern "C" UNIV_INTERN
void
=== modified file 'storage/innobase/include/ha_prototypes.h'
--- a/storage/innobase/include/ha_prototypes.h 2009-05-27 09:45:59 +0000
+++ b/storage/innobase/include/ha_prototypes.h 2009-12-01 10:38:40 +0000
@@ -153,28 +153,6 @@ get_innobase_type_from_mysql_type(
const void* field) /*!< in: MySQL Field */
__attribute__((nonnull));
-/*************************************************************//**
-If you want to print a thd that is not associated with the current thread,
-you must call this function before reserving the InnoDB kernel_mutex, to
-protect MySQL from setting thd->query NULL. If you print a thd of the current
-thread, we know that MySQL cannot modify thd->query, and it is not necessary
-to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release
-the kernel_mutex. */
-UNIV_INTERN
-void
-innobase_mysql_prepare_print_arbitrary_thd(void);
-/*============================================*/
-
-/*************************************************************//**
-Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
-In the InnoDB latching order, the mutex sits right above the
-kernel_mutex. In debug builds, we assert that the kernel_mutex is
-released before this function is invoked. */
-UNIV_INTERN
-void
-innobase_mysql_end_print_arbitrary_thd(void);
-/*========================================*/
-
/******************************************************************//**
Get the variable length bounds of the given character set. */
UNIV_INTERN
=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h 2009-10-19 13:10:22 +0000
+++ b/storage/innobase/include/trx0trx.h 2009-12-04 10:20:18 +0000
@@ -338,9 +338,7 @@ trx_commit_step(
/**********************************************************************//**
Prints info about a transaction to the given file. The caller must own the
-kernel mutex and must have called
-innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
-or InnoDB cannot meanwhile change the info printed here. */
+kernel mutex. */
UNIV_INTERN
void
trx_print(
=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c 2009-12-02 14:00:50 +0000
+++ b/storage/innobase/lock/lock0lock.c 2009-12-04 10:20:18 +0000
@@ -4324,11 +4324,6 @@ lock_print_info_summary(
/*====================*/
FILE* file) /*!< in: file where to print */
{
- /* We must protect the MySQL thd->query field with a MySQL mutex, and
- because the MySQL mutex must be reserved before the kernel_mutex of
- InnoDB, we call innobase_mysql_prepare_print_arbitrary_thd() here. */
-
- innobase_mysql_prepare_print_arbitrary_thd();
lock_mutex_enter_kernel();
if (lock_deadlock_found) {
@@ -4411,7 +4406,6 @@ loop:
if (trx == NULL) {
lock_mutex_exit_kernel();
- innobase_mysql_end_print_arbitrary_thd();
ut_ad(lock_validate());
@@ -4495,7 +4489,6 @@ loop:
}
lock_mutex_exit_kernel();
- innobase_mysql_end_print_arbitrary_thd();
mtr_start(&mtr);
@@ -4506,7 +4499,6 @@ loop:
load_page_first = FALSE;
- innobase_mysql_prepare_print_arbitrary_thd();
lock_mutex_enter_kernel();
goto loop;
=== modified file 'storage/innobase/trx/trx0i_s.c'
--- a/storage/innobase/trx/trx0i_s.c 2009-11-30 13:42:26 +0000
+++ b/storage/innobase/trx/trx0i_s.c 2009-12-01 10:38:40 +0000
@@ -1205,9 +1205,6 @@ trx_i_s_possibly_fetch_data_into_cache(
return(1);
}
- /* We are going to access trx->query in all transactions */
- innobase_mysql_prepare_print_arbitrary_thd();
-
/* We need to read trx_sys and record/table lock queues */
mutex_enter(&kernel_mutex);
@@ -1215,8 +1212,6 @@ trx_i_s_possibly_fetch_data_into_cache(
mutex_exit(&kernel_mutex);
- innobase_mysql_end_print_arbitrary_thd();
-
return(0);
}
=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c 2009-10-19 13:10:22 +0000
+++ b/storage/innobase/trx/trx0trx.c 2009-12-04 10:20:18 +0000
@@ -1636,9 +1636,7 @@ trx_mark_sql_stat_end(
/**********************************************************************//**
Prints info about a transaction to the given file. The caller must own the
-kernel mutex and must have called
-innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
-or InnoDB cannot meanwhile change the info printed here. */
+kernel mutex. */
UNIV_INTERN
void
trx_print(
Attachment: [text/bzr-bundle] bzr/gshchepa@mysql.com-20091204102018-a61t8ttaj9xe94wp.bundle
| Thread |
|---|
| • bzr commit into mysql-5.5-trunk branch (gshchepa:2938) | Gleb Shchepa | 4 Dec |