summaryrefslogtreecommitdiff
path: root/innobase/lock
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-05-17 01:52:13 +0300
committerunknown <monty@mysql.com>2004-05-17 01:52:13 +0300
commita495f76c8eed91414d321cc7536d46d1bf7bcfee (patch)
treeb9fa88577b516df5fb27de3970ec9eab9aaef532 /innobase/lock
parent8ef62cc1ef3e2b16795fa5fbbc45bcdf422f344c (diff)
parentfa163d0ba5f5fc22dbadbd66255879ceeb895c27 (diff)
downloadmariadb-git-a495f76c8eed91414d321cc7536d46d1bf7bcfee.tar.gz
Merge with 4.0.20
BitKeeper/etc/logging_ok: auto-union client/mysql.cc: Auto merged client/mysqltest.c: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/eval/eval0eval.c: Auto merged innobase/ibuf/ibuf0ibuf.c: Auto merged innobase/include/ut0mem.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/row/row0umod.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0dbg.c: Auto merged innobase/ut/ut0mem.c: Auto merged myisam/mi_dynrec.c: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/t/fulltext.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/ha_innodb.cc: Auto merged sql/item_func.cc: Auto merged sql/slave.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_show.cc: Auto merged innobase/os/os0file.c: Merge with 4.0.20 Ensure that we call F_UNLCK for files on which we call F_WRLCK. This is to ensure that this code will be portable accross most platforms. myisam/ft_boolean_search.c: Merge with 4.0.20 (keep original file) myisam/ft_parser.c: Merge with 4.0.20 (keep original file) myisam/ftdefs.h: Merge with 4.0.20 (keep original file)
Diffstat (limited to 'innobase/lock')
-rw-r--r--innobase/lock/lock0lock.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 056d502e858..223d9af78d1 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -17,6 +17,32 @@ Created 5/7/1996 Heikki Tuuri
#include "dict0mem.h"
#include "trx0sys.h"
+
+/* 2 function prototypes copied from ha_innodb.cc: */
+
+/*****************************************************************
+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.
+NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
+function! */
+
+void
+innobase_mysql_prepare_print_arbitrary_thd(void);
+/*============================================*/
+
+/*****************************************************************
+Relases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd().
+NOTE that /mysql/innobase/lock/lock0lock.c must contain the prototype for this
+function! */
+
+void
+innobase_mysql_end_print_arbitrary_thd(void);
+/*========================================*/
+
/* Restricts the length of search we will do in the waits-for
graph of transactions */
#define LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK 1000000
@@ -1629,7 +1655,8 @@ lock_rec_enqueue_waiting(
" InnoDB: Error: a record lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr);
ut_print_name(stderr, index->table_name);
- fputs(". Send a bug report to mysql@lists.mysql.com\n",
+ fputs(".\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr);
}
@@ -3269,7 +3296,8 @@ lock_table_enqueue_waiting(
" InnoDB: Error: a table lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr);
ut_print_name(stderr, table->name);
- fputs(". Send a bug report to mysql@lists.mysql.com\n",
+ fputs(".\n"
+"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr);
}
@@ -3975,6 +4003,11 @@ lock_print_info(
ulint i;
mtr_t mtr;
+ /* 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) {
@@ -4038,6 +4071,7 @@ loop:
if (trx == NULL) {
lock_mutex_exit_kernel();
+ innobase_mysql_end_print_arbitrary_thd();
ut_ad(lock_validate());
@@ -4102,6 +4136,7 @@ loop:
if (load_page_first) {
lock_mutex_exit_kernel();
+ innobase_mysql_end_print_arbitrary_thd();
mtr_start(&mtr);
@@ -4111,6 +4146,7 @@ loop:
load_page_first = FALSE;
+ innobase_mysql_prepare_print_arbitrary_thd();
lock_mutex_enter_kernel();
goto loop;