summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authormarko@hundin.mysql.fi <>2005-06-17 15:29:03 +0300
committermarko@hundin.mysql.fi <>2005-06-17 15:29:03 +0300
commit85515b579e57b10c188145b397a63f08c84fbe3e (patch)
tree19bf233f6f11472bd1fd38775a01219620a62348 /innobase
parenta5025b8ebee0bd6a48a5bf83bccfd93e867399ed (diff)
downloadmariadb-git-85515b579e57b10c188145b397a63f08c84fbe3e.tar.gz
InnoDB: remove flag lock_print_waits from non-debug builds.
Diffstat (limited to 'innobase')
-rw-r--r--innobase/include/lock0lock.h2
-rw-r--r--innobase/lock/lock0lock.c26
-rw-r--r--innobase/trx/trx0roll.c2
3 files changed, 28 insertions, 2 deletions
diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h
index 3f39a0b40c7..ce308e50651 100644
--- a/innobase/include/lock0lock.h
+++ b/innobase/include/lock0lock.h
@@ -19,7 +19,9 @@ Created 5/7/1996 Heikki Tuuri
#include "read0types.h"
#include "hash0hash.h"
+#ifdef UNIV_DEBUG
extern ibool lock_print_waits;
+#endif /* UNIV_DEBUG */
/* Buffer for storing information about the most recent deadlock error */
extern FILE* lock_latest_err_file;
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index d28cc99ac38..cdb4f1ee73e 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -292,7 +292,25 @@ waiting, in its lock queue. Solution: We can copy the locks as gap type
locks, so that also the waiting locks are transformed to granted gap type
locks on the inserted record. */
+/* LOCK COMPATIBILITY MATRIX
+ * IS IX S X AI
+ * IS + + + - +
+ * IX + + - - +
+ * S + - + - -
+ * X - - - - -
+ * AI + + - - -
+ *
+ * Note that for rows, InnoDB only acquires S or X locks.
+ * For tables, InnoDB normally acquires IS or IX locks.
+ * S or X table locks are only acquired for LOCK TABLES.
+ * Auto-increment (AI) locks are needed because of
+ * statement-level MySQL binlog.
+ * See also lock_mode_compatible().
+ */
+
+#ifdef UNIV_DEBUG
ibool lock_print_waits = FALSE;
+#endif /* UNIV_DEBUG */
/* The lock system */
lock_sys_t* lock_sys = NULL;
@@ -1842,11 +1860,13 @@ lock_rec_enqueue_waiting(
ut_a(que_thr_stop(thr));
+#ifdef UNIV_DEBUG
if (lock_print_waits) {
fprintf(stderr, "Lock wait for trx %lu in index ",
(ulong) ut_dulint_get_low(trx->id));
ut_print_name(stderr, trx, index->name);
}
+#endif /* UNIV_DEBUG */
return(DB_LOCK_WAIT);
}
@@ -2204,10 +2224,12 @@ lock_grant(
lock->trx->auto_inc_lock = lock;
}
+#ifdef UNIV_DEBUG
if (lock_print_waits) {
fprintf(stderr, "Lock wait for trx %lu ends\n",
(ulong) ut_dulint_get_low(lock->trx->id));
}
+#endif /* UNIV_DEBUG */
/* If we are resolving a deadlock by choosing another transaction
as a victim, then our original transaction may not be in the
@@ -3303,11 +3325,11 @@ lock_deadlock_recursive(
} else {
lock_table_print(ef, start->wait_lock);
}
-
+#ifdef UNIV_DEBUG
if (lock_print_waits) {
fputs("Deadlock detected\n", stderr);
}
-
+#endif /* UNIV_DEBUG */
if (ut_dulint_cmp(wait_lock->trx->undo_no,
start->undo_no) >= 0) {
/* Our recursion starting point
diff --git a/innobase/trx/trx0roll.c b/innobase/trx/trx0roll.c
index 69f7a99187f..fdfb7428129 100644
--- a/innobase/trx/trx0roll.c
+++ b/innobase/trx/trx0roll.c
@@ -1237,10 +1237,12 @@ trx_finish_rollback_off_kernel(
return;
}
+#ifdef UNIV_DEBUG
if (lock_print_waits) {
fprintf(stderr, "Trx %lu rollback finished\n",
(ulong) ut_dulint_get_low(trx->id));
}
+#endif /* UNIV_DEBUG */
trx_commit_off_kernel(trx);