From f3e12c7567cd11fcf118adb14d9fc22f84a51b84 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@sun.com>
Date: Wed, 2 Jun 2010 12:06:07 +0400
Subject: [PATCH] Add comments to a few MDL deadlock-search related variables
 and methods.

---
 sql/mdl.cc | 12 +++++++++++-
 sql/mdl.h  |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/sql/mdl.cc b/sql/mdl.cc
index ba938f8714b..b3702997168 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -119,8 +119,18 @@ class Deadlock_detection_context
       victim(NULL),
       current_search_depth(0)
   { }
+  /**
+    The context which has initiated the search. There
+    can be multiple searches happening in parallel at the same time.
+  */
   MDL_context *start;
+  /** If a deadlock is found, the context that identifies the victim. */
   MDL_context *victim;
+  /** Set to the MAX_SEARCH_DEPTH at start. Decreased whenever
+    we descend into another MDL context (aka traverse to the next
+    wait-for graph node). When 0 is reached, we assume that
+    a deadlock is found, even if we have not found a loop.
+  */
   uint current_search_depth;
   /**
     Maximum depth for deadlock searches. After this depth is
@@ -408,7 +418,7 @@ mdl_locks_key(const uchar *record, size_t *length,
   statement, the design capitalizes on that to later save on
   look ups in the table definition cache. This leads to reduced
   contention overall and on LOCK_open in particular.
-  Please see the description of MDL_context::acquire_shared_lock()
+  Please see the description of MDL_context::acquire_lock_impl()
   for details.
 */
 
diff --git a/sql/mdl.h b/sql/mdl.h
index 2e296b73057..1a123d5baa9 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -322,6 +322,7 @@ class MDL_request
     DBUG_ASSERT(ticket == NULL);
     type= type_arg;
   }
+  /* A helper used to determine which lock request should be aborted. */
   uint get_deadlock_weight() const;
 
   static MDL_request *create(MDL_key::enum_mdl_namespace mdl_namespace,
-- 
2.30.9