List:Commits« Previous MessageNext Message »
From:Marc Alff Date:April 1 2011 1:59pm
Subject:bzr push into mysql-trunk-lock-order branch (marc.alff:3351 to 3352)
View as plain text  
 3352 Marc Alff	2011-04-01
      Work in progress

    modified:
      sql/debug_lock_order.cc
      sql/mysqld.cc
 3351 Marc Alff	2011-03-31
      lock order, continued

    modified:
      sql/debug_lock_order.cc
      sql/mysqld.cc
=== modified file 'sql/debug_lock_order.cc'
--- a/sql/debug_lock_order.cc	2011-03-31 16:13:26 +0000
+++ b/sql/debug_lock_order.cc	2011-04-01 13:57:17 +0000
@@ -5,12 +5,15 @@
 #include "mysqld.h"
 #include "debug_lock_order.h"
 
-static void debug_lock_order_break_here()
+static void debug_lock_order_break_here(const char* why)
 {
 static int debugger_calls= 0;
 
   /* Put a breakpoint here in your debugger. */
   debugger_calls++;
+
+  fprintf(stderr, "LOCK ORDER message: %s\n", why);
+  DBUG_ASSERT(false);
 }
 
 #define LO_MAX_THREAD_CLASS 100
@@ -247,6 +250,7 @@ public:
 
   void dump_dot();
   void dump_txt();
+  void dump_cycle(FILE *out, const LO_node *from, const LO_node *to, const LO_node_list& cycle);
 
 private:
   LO_node_list m_nodes;
@@ -287,7 +291,7 @@ void LO_graph::add_node(LO_node *node)
 
   for (it= m_unresolved_arcs.begin();
        it != m_unresolved_arcs.end();
-       it++)
+       /* nothing */)
   {
     unresolved_arc= *it;
     if (strcmp(unresolved_arc->m_from_name, node->get_qname()) == 0)
@@ -296,7 +300,8 @@ void LO_graph::add_node(LO_node *node)
       if (n != NULL)
       {
         add_arc(node, n, unresolved_arc->m_flags);
-        m_unresolved_arcs.erase(it);
+        it= m_unresolved_arcs.erase(it);
+        continue;
       }
     }
 
@@ -306,9 +311,12 @@ void LO_graph::add_node(LO_node *node)
       if (n != NULL)
       {
         add_arc(n, node, unresolved_arc->m_flags);
-        m_unresolved_arcs.erase(it);
+        it= m_unresolved_arcs.erase(it);
+        continue;
       }
     }
+
+    it++;
   }
 }
 
@@ -321,6 +329,10 @@ bool LO_graph::find_path(LO_node *from, 
   LO_arc *arc;
   LO_node *n;
 
+  DBUG_ASSERT(from != NULL);
+  DBUG_ASSERT(to != NULL);
+  DBUG_ASSERT(from != to);
+
   for (it= out_list.begin();
        it != out_list.end();
        it++)
@@ -421,6 +433,24 @@ void LO_graph::dump_dot()
   }
 }
 
+void LO_graph::dump_cycle(FILE *out, const LO_node *from, const LO_node *to, const LO_node_list& cycle)
+{
+  fprintf(out, "  Cycle loop link %s -> %s\n",
+          from->get_qname(), to->get_qname());
+
+  LO_node_list::const_iterator it;
+  LO_node *node;
+  int node_count= 1;
+
+  for (it= cycle.begin();
+       it != cycle.end();
+       it++, node_count++)
+  {
+    node= *it;
+    fprintf(out, "  Cycle node %d: %s\n", node_count, node->get_qname());
+  }
+}
+
 void LO_graph::dump_txt()
 {
   if (out_txt == NULL)
@@ -499,20 +529,8 @@ void LO_graph::dump_txt()
       {
         cycle_count++;
 
-        fprintf(out_txt, "Dumping cycle %d, %s -> %s\n",
-                cycle_count, from->get_qname(), to->get_qname());
-
-        LO_node_list::const_iterator it;
-        LO_node *node;
-        int link= 1;
-
-        for (it= cycle.begin();
-             it != cycle.end();
-             it++, link++)
-        {
-          node= *it;
-          fprintf(out_txt, "  Cycle link %d: %s\n", link, node->get_qname());
-        }
+        fprintf(out_txt, "Dumping cycle %d\n", cycle_count);
+        dump_cycle(out_txt, from, to, cycle);
       }
       else
       {
@@ -538,9 +556,6 @@ void LO_graph::dump_txt()
     unresolved_arc= *it;
     fprintf(out_txt, "  - %s -> %s\n", unresolved_arc->m_from_name, unresolved_arc->m_to_name);
   }
- 
-  fclose(out_txt);
-  out_txt= NULL;
 }
 
 LO_graph global_graph;
@@ -583,6 +598,8 @@ public:
   LO_mutex_locker* create_mutex_locker(LO_mutex *mutex);
   LO_rwlock_locker* create_rwlock_locker(LO_rwlock *rwlock);
 
+  void check_locks(const LO_lock *new_lock);
+
   void add_mutex_lock(LO_mutex *mutex, const char *src_file, int src_line);
   void remove_mutex_lock(LO_mutex *mutex);
 
@@ -616,7 +633,6 @@ private:
   static LO_mutex_class *m_array[LO_MAX_MUTEX_CLASS];
 
   int m_key;
-  char m_short_name[10];
 };
 
 class LO_mutex
@@ -733,7 +749,6 @@ private:
   static LO_rwlock_class *m_array[LO_MAX_RWLOCK_CLASS];
 
   int m_key;
-  char m_short_name[10];
 };
 
 class LO_rwlock
@@ -751,12 +766,14 @@ public:
 
   void set_locked_by(const char *src_file, int src_line)
   {
+    // FIXME, list
     m_locking_src_file= src_file;
     m_locking_src_line= src_line;
   }
 
   void set_unlocked()
   {
+    // FIXME, list
     m_locking_src_file= "UNLOCKED";
     m_locking_src_line= 0;
   }
@@ -847,35 +864,39 @@ void LO_graph::check(const LO_lock *old_
 
   if (arc == NULL)
   {
+    char buff[1024];
+    sprintf(buff, "Error: missing arc %s -> %s\n", old_node->get_qname(), new_node->get_qname());
+    
     if (out_log != NULL)
     {
-      fprintf(out_log,
-        "Error: missing arc %s -> %s\n",
-        old_node->get_qname(),
-        new_node->get_qname());
+      fprintf(out_log, "%s", buff);
     }
+    debug_lock_order_break_here(buff);
+    return;
   }
-  else
+
+  if (arc->has_trace())
   {
-    if (arc->has_trace())
-    {
-      if (out_log != NULL)
-      {
-        fprintf(out_log,
-          "Trace: using arc %s (%s:%d) -> %s (%s:%d)\n",
-          old_node->get_qname(),
-          old_lock->get_locking_src_file(),
-          old_lock->get_locking_src_line(),
-          new_node->get_qname(),
-          new_lock->get_locking_src_file(),
-          new_lock->get_locking_src_line());
-      }
-    }
-    if (arc->has_debug())
+    if (out_log != NULL)
     {
-      debug_lock_order_break_here();
+      fprintf(out_log,
+        "Trace: using arc %s (%s:%d) -> %s (%s:%d)\n",
+        old_node->get_qname(),
+        old_lock->get_locking_src_file(),
+        old_lock->get_locking_src_line(),
+        new_node->get_qname(),
+        new_lock->get_locking_src_file(),
+        new_lock->get_locking_src_line());
     }
   }
+
+  if (arc->has_debug())
+  {
+    char buff[1024];
+    sprintf(buff, "Debug flag set on arc %s -> %s\n", old_node->get_qname(), new_node->get_qname());
+    
+    debug_lock_order_break_here(buff);
+  }
 }
 
 void LO_graph::add_arc(LO_authorised_arc *arc)
@@ -883,11 +904,16 @@ void LO_graph::add_arc(LO_authorised_arc
   LO_node *from;
   LO_node *to;
 
+  DBUG_ASSERT(strcmp(arc->m_from_name, arc->m_to_name) != 0);
+
   from= find_node(arc->m_from_name);
   to= find_node(arc->m_to_name);
 
   if ((from != NULL) && (to != NULL))
+  {
+    DBUG_ASSERT(from != to);
     add_arc(from, to, arc->m_flags);
+  }
   else
     add_unresolved_arc(arc);
 }
@@ -900,34 +926,11 @@ void LO_graph::add_arc(LO_node *from, LO
   {
     if ((out_log != NULL) && ! is_loop)
     {
-      fprintf(out_log,
-        "Error: Cycle dependency, %s -> %s\n",
-        from->get_qname(), to->get_qname());
-
-      LO_node_list::const_iterator it;
-      LO_node *node;
-      int link= 1;
-
-      for (it= cycle.begin();
-           it != cycle.end();
-           it++, link++)
-      {
-        node= *it;
-        fprintf(out_log, "Cycle link %d: %s\n", link, node->get_qname());
-      }
+      dump_cycle(out_log, from, to, cycle);
     }
     return;
   }
 
-#ifdef LATER
-  if (out_log != NULL && is_loop)
-  {
-   fprintf(out_log,
-     "Error: Arc is not a loop %s -> %s\n",
-     from->get_qname(), to->get_qname());
-  }
-#endif
-
   const LO_arc_list& arcs_out= from->get_arcs_out();
   LO_arc_list::const_iterator it;
   LO_arc *arc;
@@ -1008,22 +1011,41 @@ LO_rwlock_locker *LO_thread::create_rwlo
   return new LO_rwlock_locker(this, rwlock);
 }
 
+void LO_thread::check_locks(const LO_lock *new_lock)
+{
+  DBUG_ASSERT(new_lock != NULL);
+
+  const LO_mutex_lock *old_mutex_lock;
+  LO_mutex_lock_list::const_iterator it_mutex;
+
+  for (it_mutex= m_mutex_locks.begin();
+       it_mutex != m_mutex_locks.end();
+       it_mutex++)
+  {
+    old_mutex_lock= *it_mutex;
+    global_graph.check(old_mutex_lock, new_lock);
+  }
+
+  const LO_rwlock_lock *old_rwlock_lock;
+  LO_rwlock_lock_list::const_iterator it_rwlock;
+
+  for (it_rwlock= m_rwlock_locks.begin();
+       it_rwlock != m_rwlock_locks.end();
+       it_rwlock++)
+  {
+    old_rwlock_lock= *it_rwlock;
+    global_graph.check(old_rwlock_lock, new_lock);
+  }
+}
+
 void LO_thread::add_mutex_lock(LO_mutex *mutex,
                                const char *src_file, int src_line)
 {
-  const LO_mutex_lock *old_lock;
   LO_mutex_lock *new_lock;
   new_lock= new LO_mutex_lock(mutex, src_file, src_line);
   mutex->set_locked_by(src_file, src_line);
-  LO_mutex_lock_list::const_iterator it;
 
-  for (it= m_mutex_locks.begin();
-       it != m_mutex_locks.end();
-       it++)
-  {
-    old_lock= *it;
-    global_graph.check(old_lock, new_lock);
-  }
+  check_locks(new_lock);
 
   m_mutex_locks.push_front(new_lock);
 }
@@ -1040,32 +1062,29 @@ void LO_thread::remove_mutex_lock(LO_mut
     old_lock= *it;
     if (old_lock->get_mutex() == mutex)
     {
-      m_mutex_locks.erase(it);
+      it= m_mutex_locks.erase(it);
       delete old_lock;
-      break;
+      mutex->set_unlocked();
+      return;
     }
   }
 
-  mutex->set_unlocked();
+  if (out_log != NULL)
+  {
+    fprintf(out_log, "Unlocking a mutex that this thread did not lock: %s\n",
+            mutex->get_class()->get_qname());
+  }
 }
 
 void LO_thread::add_rwlock_lock(LO_rwlock *rwlock,
                                 const char *src_file, int src_line)
 {
 #ifdef LATER
-  const LO_rwlock_lock *old_lock;
   LO_rwlock_lock *new_lock;
   new_lock= new LO_rwlock_lock(rwlock, src_file, src_line);
   rwlock->set_locked_by(src_file, src_line);
-  LO_rwlock_lock_list::const_iterator it;
 
-  for (it= m_rwlock_locks.begin();
-       it != m_rwlock_locks.end();
-       it++)
-  {
-    old_lock= *it;
-    global_graph.check(old_lock, new_lock);
-  }
+  check_locks(new_lock);
 
   m_rwlock_locks.push_front(new_lock);
 #endif
@@ -1077,7 +1096,6 @@ void LO_thread::remove_rwlock_lock(LO_rw
   LO_rwlock_lock *old_lock;
   LO_rwlock_lock_list::iterator it;
 
-// TODO
   for (it= m_rwlock_locks.begin();
        it != m_rwlock_locks.end();
        it++)
@@ -1085,14 +1103,19 @@ void LO_thread::remove_rwlock_lock(LO_rw
     old_lock= *it;
     if (old_lock->get_rwlock() == rwlock)
     {
-      m_rwlock_locks.erase(it);
+      it= m_rwlock_locks.erase(it);
       delete old_lock;
-      break;
+      // TODO
+      rwlock->set_unlocked();
+      return;
     }
   }
 
-// TODO
-  rwlock->set_unlocked();
+  if (out_log != NULL)
+  {
+    fprintf(out_log, "Unlocking a rwlock that this thread did not lock: %s\n",
+            rwlock->get_class()->get_qname());
+  }
 #endif
 }
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-03-31 16:13:26 +0000
+++ b/sql/mysqld.cc	2011-04-01 13:57:17 +0000
@@ -122,6 +122,8 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/innodb/fil_system_mutex", "mutex/innodb/rw_lock_list_mutex", 0},
 
   {"mutex/innodb/file_format_max_mutex", "mutex/innodb/log_sys_mutex", 0},
+  {"mutex/innodb/file_format_max_mutex", "mutex/innodb/flush_list_mutex", 0},
+  {"mutex/innodb/file_format_max_mutex", "mutex/innodb/log_flush_order_mutex", 0},
 
   {"mutex/innodb/ibuf_mutex", "mutex/innodb/buf_pool_mutex", 0},
   {"mutex/innodb/ibuf_mutex", "mutex/innodb/fil_system_mutex", 0},
@@ -129,6 +131,7 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/innodb/ibuf_mutex", "mutex/innodb/os_mutex", 0},
   {"mutex/innodb/ibuf_mutex", "mutex/innodb/recv_sys_mutex", 0},
 
+  {"mutex/innodb/ibuf_bitmap_mutex", "mutex/innodb/buf_pool_mutex", 0},
 
   {"mutex/innodb/lock_mutex", "mutex/innodb/trx_mutex", 0},
   {"mutex/innodb/lock_mutex", "mutex/sql/THD::LOCK_thd_data", 0},
@@ -147,6 +150,8 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/innodb/log_sys_mutex", "mutex/innodb/rw_lock_list_mutex", 0},
   {"mutex/innodb/log_sys_mutex", "mutex/innodb/mutex_list_mutex", 0},
   {"mutex/innodb/log_sys_mutex", "mutex/innodb/recv_sys_mutex", 0},
+  {"mutex/innodb/log_sys_mutex", "mutex/innodb/buf_pool_mutex", 0},
+  {"mutex/innodb/log_sys_mutex", "mutex/innodb/srv_sys_mutex", 0},
 
   {"mutex/innodb/prepare_commit_mutex", "mutex/innodb/lock_mutex", 0},
   {"mutex/innodb/prepare_commit_mutex", "mutex/innodb/log_sys_mutex", 0},
@@ -155,6 +160,9 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/innodb/prepare_commit_mutex", "mutex/sql/LOG::LOCK_log", 0},
   {"mutex/innodb/prepare_commit_mutex", "mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids", 0},
   {"mutex/innodb/prepare_commit_mutex", "mutex/innodb/read_view_mutex", 0},
+  {"mutex/innodb/prepare_commit_mutex", "mutex/innodb/flush_list_mutex", 0},
+  {"mutex/innodb/prepare_commit_mutex", "mutex/innodb/log_flush_order_mutex", 0},
+  {"mutex/innodb/prepare_commit_mutex", "mutex/innodb/purge_sys_bh_mutex", 0},
 
   {"mutex/innodb/rseg_mutex", "mutex/innodb/buf_pool_mutex", 0},
   {"mutex/innodb/rseg_mutex", "mutex/innodb/fil_system_mutex", 0},
@@ -164,6 +172,7 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/innodb/rseg_mutex", "mutex/innodb/flush_list_mutex", 0},
   {"mutex/innodb/rseg_mutex", "mutex/innodb/os_mutex", 0},
   {"mutex/innodb/rseg_mutex", "mutex/innodb/buf_pool_zip_mutex", 0},
+  {"mutex/innodb/rseg_mutex", "mutex/innodb/trx_doublewrite_mutex", 0},
 
   {"mutex/innodb/rw_lock_list_mutex", "mutex/innodb/os_mutex", 0},
 
@@ -209,6 +218,7 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/innodb/trx_undo_mutex", "mutex/innodb/rseg_mutex", 0},
   {"mutex/innodb/trx_undo_mutex", "mutex/innodb/os_mutex", 0},
   {"mutex/innodb/trx_undo_mutex", "mutex/innodb/buf_pool_zip_mutex", 0},
+  {"mutex/innodb/trx_undo_mutex", "mutex/innodb/trx_doublewrite_mutex", 0},
 
   {"mutex/myisam/MYISAM_SHARE::intern_lock", "mutex/mysys/KEY_CACHE::cache_lock", 0},
   {"mutex/myisam/MYISAM_SHARE::intern_lock", "mutex/sql/LOCK_error_log", 0},
@@ -292,6 +302,7 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/LOCK_gdl", "mutex/innodb/os_mutex", 0},
   {"mutex/sql/LOCK_gdl", "mutex/innodb/srv_sys_mutex", 0},
   {"mutex/sql/LOCK_gdl", "mutex/innodb/trx_mutex", 0},
+  {"mutex/sql/LOCK_gdl", "mutex/innodb/fil_system_mutex", 0},
 
   {"mutex/sql/LOCK_active_mi", "mutex/myisam/MYISAM_SHARE::intern_lock", 0},
   {"mutex/sql/LOCK_active_mi", "mutex/mysys/THR_LOCK::mutex", 0},
@@ -311,7 +322,7 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/LOCK_active_mi", "mutex/mysys/THR_LOCK_charset", 0},
   {"mutex/sql/LOCK_active_mi", "mutex/mysys/KEY_CACHE::cache_lock", 0},
   {"mutex/sql/LOCK_active_mi", "mutex/sql/Master_info::run_lock", 0},
-  {"mutex/sql/LOCK_active_mi", "mutex/sql/Relay_log_info::run_lock", LO_FLAG_TRACE | LO_FLAG_DEBUG}, // testing flags
+  {"mutex/sql/LOCK_active_mi", "mutex/sql/Relay_log_info::run_lock", 0},
   {"mutex/sql/LOCK_active_mi", "mutex/sql/Slave_reporting_capability::err_lock", 0},
   {"mutex/sql/LOCK_active_mi", "mutex/mysys/IO_CACHE::append_buffer_lock", 0},
   {"mutex/sql/LOCK_active_mi", "mutex/sql/LOG::LOCK_log", 0},
@@ -329,7 +340,6 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/LOCK_global_system_variables", "mutex/sql/DEBUG_SYNC::mutex", 0},
   {"mutex/sql/LOCK_global_system_variables", "mutex/mysys/LOCK_alarm", 0},
   {"mutex/sql/LOCK_global_system_variables", "mutex/sql/Relay_log_info::data_lock", 0},
-  {"mutex/sql/LOCK_global_system_variables", "mutex/sql/Relay_log_info::run_lock", 0},
   {"mutex/sql/LOCK_global_system_variables", "mutex/sql/LOG::LOCK_log", 0},
   {"mutex/sql/LOCK_global_system_variables", "mutex/innodb/file_format_max_mutex", 0},
   {"mutex/sql/LOCK_global_system_variables", "mutex/innodb/log_sys_mutex", 0},
@@ -367,10 +377,16 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/LOCK_status", "mutex/sql/LOCK_thread_count", 0},
   {"mutex/sql/LOCK_status", "mutex/sql/LOG::LOCK_log", 0},
   {"mutex/sql/LOCK_status", "mutex/sql/Query_cache::structure_guard_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/innodb/dict_sys_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/innodb/lock_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/innodb/log_sys_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/innodb/rseg_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/innodb/trx_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/innodb/trx_undo_mutex", 0},
+  {"mutex/sql/LOCK_status", "mutex/sql/THD::LOCK_thd_data", 0},
 
   {"mutex/sql/LOCK_thread_count", "mutex/sql/LOCK_plugin", 0},
   {"mutex/sql/LOCK_thread_count", "mutex/sql/LOCK_prepared_stmt_count", 0},
-  {"mutex/sql/LOCK_thread_count", "mutex/sql/THD::LOCK_thd_data", 0},
   {"mutex/sql/LOCK_thread_count", "mutex/innodb/mutex_list_mutex", 0},
   {"mutex/sql/LOCK_thread_count", "mutex/innodb/os_mutex", 0},
   {"mutex/sql/LOCK_thread_count", "mutex/innodb/trx_mutex", 0},
@@ -381,6 +397,9 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/LOCK_thread_count", "mutex/mysys/my_thread_var::mutex", 0},
   {"mutex/sql/LOCK_thread_count", "mutex/sql/LOCK_event_queue", 0},
   {"mutex/sql/LOCK_thread_count", "mutex/mysys/THR_LOCK_open", 0},
+  {"mutex/sql/LOCK_thread_count", "mutex/mysys/IO_CACHE::append_buffer_lock", 0},
+
+  {"mutex/sql/LOCK_user_conn", "mutex/sql/hash_filo::lock", 0},
 
   {"mutex/sql/THD::LOCK_thd_data", "mutex/mysys/LOCK_alarm", 0},
   {"mutex/sql/THD::LOCK_thd_data", "mutex/sql/LOCK_error_log", 0},
@@ -389,6 +408,7 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/THD::LOCK_thd_data", "mutex/sql/DEBUG_SYNC::mutex", 0},
   {"mutex/sql/THD::LOCK_thd_data", "mutex/sql/LOCK_user_locks", 0},
   {"mutex/sql/THD::LOCK_thd_data", "mutex/sql/MDL_wait::LOCK_wait_status", 0},
+  {"mutex/sql/THD::LOCK_thd_data", "mutex/sql/LOG::LOCK_log", 0},
 
   {"mutex/sql/LOCK_uuid_generator", "mutex/sql/LOCK_thread_count", 0},
 
@@ -397,12 +417,53 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/Master_info::data_lock", "mutex/mysys/THR_LOCK_open", 0},
   {"mutex/sql/Master_info::data_lock", "mutex/sql/LOG::LOCK_log", 0},
   {"mutex/sql/Master_info::data_lock", "mutex/sql/MYSQL_RELAY_LOG::LOCK_index", 0},
+  {"mutex/sql/Master_info::data_lock", "mutex/sql/Slave_reporting_capability::err_lock", 0},
 
-  {"mutex/sql/Master_info::run_lock", "mutex/sql/Relay_log_info::run_lock", 0},
   {"mutex/sql/Master_info::run_lock", "mutex/sql/Slave_reporting_capability::err_lock", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/mysys/IO_CACHE::append_buffer_lock", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/mysys/LOCK_alarm", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/mysys/THR_LOCK_open", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/mysys/my_thread_var::mutex", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/DEBUG_SYNC::mutex", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOCK_error_log", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOCK_global_system_variables", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOCK_plugin", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOCK_prepared_stmt_count", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOCK_thread_count", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOCK_xid_cache", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/LOG::LOCK_log", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/MYSQL_RELAY_LOG::LOCK_index", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/Master_info::data_lock", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/Relay_log_info::data_lock", 0},
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/THD::LOCK_thd_data", 0},
 
   {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/Slave_reporting_capability::err_lock", 0},
   {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/Relay_log_info::data_lock", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/mysys/IO_CACHE::append_buffer_lock", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/mysys/LOCK_alarm", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/mysys/THR_LOCK_open", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/mysys/my_thread_var::mutex", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/DEBUG_SYNC::mutex", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOCK_error_log", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOCK_plugin", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOCK_prepared_stmt_count", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOCK_thread_count", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOCK_xid_cache", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOG::LOCK_log", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/MYSQL_RELAY_LOG::LOCK_index", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/Master_info::data_lock", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/THD::LOCK_thd_data", 0},
+
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/mysys/IO_CACHE::append_buffer_lock", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/mysys/THR_LOCK_open", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/sql/LOCK_error_log", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/sql/LOCK_thread_count", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/sql/LOG::LOCK_log", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/sql/MYSQL_RELAY_LOG::LOCK_index", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/sql/Relay_log_info::log_space_lock", 0},
+  {"mutex/sql/Relay_log_info::data_lock", "mutex/sql/Slave_reporting_capability::err_lock", 0},
+
+  {"mutex/sql/Relay_log_info::log_space_lock", "mutex/mysys/THR_LOCK_open", 0},
 
   {"mutex/sql/MYSQL_BIN_LOG::LOCK_index", "mutex/mysys/THR_LOCK_open", 0},
   {"mutex/sql/MYSQL_BIN_LOG::LOCK_index", "mutex/sql/LOCK_thread_count", 0},
@@ -434,6 +495,10 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/tz_LOCK", "mutex/sql/LOCK_open", 0},
   {"mutex/sql/tz_LOCK", "mutex/sql/MDL_map::mutex", 0},
   {"mutex/sql/tz_LOCK", "mutex/sql/THD::LOCK_thd_data", 0},
+  {"mutex/sql/tz_LOCK", "mutex/mysys/THR_LOCK_myisam", 0},
+  {"mutex/sql/tz_LOCK", "mutex/mysys/THR_LOCK_open", 0},
+  {"mutex/sql/tz_LOCK", "mutex/sql/LOCK_plugin", 0},
+  {"mutex/sql/tz_LOCK", "mutex/sql/TABLE_SHARE::LOCK_ha_data", 0},
 
   {"mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc", "mutex/archive/ARCHIVE_SHARE::mutex", 0},
   {"mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc", "mutex/myisam/MYISAM_SHARE::intern_lock", 0},
@@ -447,47 +512,91 @@ static LO_authorised_arc debug_lock_orde
   {"mutex/sql/HA_DATA_PARTITION::LOCK_auto_inc", "mutex/sql/LOG::LOCK_log", 0},
 
 /*
-  Error: Cycle dependency, mysys/my_thread_var::mutex -> sql/Delayed_insert::mutex
-  Cycle link 1: sql/Delayed_insert::mutex
-  Cycle link 2: sql/THD::LOCK_thd_data
-  Cycle link 3: mysys/my_thread_var::mutex
+  Cycle loop link mutex/mysys/my_thread_var::mutex -> mutex/sql/Delayed_insert::mutex
+  Cycle node 1: mutex/sql/Delayed_insert::mutex
+  Cycle node 2: mutex/myisam/MYISAM_SHARE::intern_lock
+  Cycle node 3: mutex/sql/THD::LOCK_thd_data
+  Cycle node 4: mutex/mysys/my_thread_var::mutex
 */
   {"mutex/sql/Delayed_insert::mutex", "mutex/sql/THD::LOCK_thd_data", 0},
   {"mutex/sql/THD::LOCK_thd_data", "mutex/mysys/my_thread_var::mutex", 0},
   {"mutex/mysys/my_thread_var::mutex", "mutex/sql/Delayed_insert::mutex", LO_FLAG_LOOP},
 
 /*
-  Error: Cycle dependency, sql/Delayed_insert::mutex -> sql/LOCK_open
-  Cycle link 1: sql/LOCK_open
-  Cycle link 2: sql/Delayed_insert::mutex
+  Cycle loop link mutex/sql/LOCK_open -> mutex/sql/LOCK_delayed_insert
+  Cycle node 1: mutex/sql/LOCK_delayed_insert
+  Cycle node 2: mutex/sql/Delayed_insert::mutex
+  Cycle node 3: mutex/sql/LOCK_open
 */
   {"mutex/sql/Delayed_insert::mutex", "mutex/sql/LOCK_open", 0},
   {"mutex/sql/LOCK_open", "mutex/sql/Delayed_insert::mutex", LO_FLAG_LOOP},
 
 /*
-  Error: Cycle dependency, sql/LOCK_active_mi -> sql/LOCK_global_system_variables
-  Cycle link 1: sql/LOCK_global_system_variables
-  Cycle link 2: sql/LOCK_active_mi
+  Cycle loop link mutex/sql/LOCK_global_system_variables -> mutex/sql/LOCK_active_mi
+  Cycle node 1: mutex/sql/LOCK_active_mi
+  Cycle node 2: mutex/sql/LOCK_open
+  Cycle node 3: mutex/innodb/dict_sys_mutex
+  Cycle node 4: mutex/sql/LOCK_global_system_variables
 */
   {"mutex/sql/LOCK_active_mi", "mutex/sql/LOCK_global_system_variables", 0},
   {"mutex/sql/LOCK_global_system_variables", "mutex/sql/LOCK_active_mi", LO_FLAG_LOOP},
 
 /*
-  Error: Cycle dependency, sql/LOCK_open -> sql/LOCK_delayed_insert
-  Cycle link 1: sql/LOCK_delayed_insert
-  Cycle link 2: sql/Delayed_insert::mutex
-  Cycle link 3: sql/LOCK_open
+  Cycle loop link mutex/sql/LOCK_open -> mutex/sql/LOCK_delayed_insert
+  Cycle node 1: mutex/sql/LOCK_delayed_insert
+  Cycle node 2: mutex/sql/Delayed_insert::mutex
+  Cycle node 3: mutex/sql/LOCK_open
 */
   {"mutex/sql/LOCK_open", "mutex/sql/LOCK_delayed_insert", LO_FLAG_LOOP},
 
 /*
-  Error: Cycle dependency, mysys/my_thread_var::mutex -> sql/LOG::LOCK_log
-  Cycle link 1: sql/LOG::LOCK_log
-  Cycle link 2: sql/LOCK_thread_count
-  Cycle link 3: mysys/my_thread_var::mutex
+  Cycle loop link mutex/mysys/my_thread_var::mutex -> mutex/sql/LOG::LOCK_log
+  Cycle node 1: mutex/sql/LOG::LOCK_log
+  Cycle node 2: mutex/sql/LOCK_thread_count
+  Cycle node 3: mutex/mysys/my_thread_var::mutex
 */
   {"mutex/mysys/my_thread_var::mutex", "mutex/sql/LOG::LOCK_log", LO_FLAG_LOOP},
 
+/*
+  Cycle loop link mutex/sql/LOCK_thread_count -> mutex/sql/LOG::LOCK_log
+  Cycle node 1: mutex/sql/LOG::LOCK_log
+  Cycle node 2: mutex/sql/LOCK_thread_count
+*/
+  {"mutex/sql/LOCK_thread_count", "mutex/sql/LOG::LOCK_log", LO_FLAG_LOOP | LO_FLAG_TRACE | LO_FLAG_DEBUG},
+
+/*
+  Cycle loop link mutex/sql/LOCK_thread_count -> mutex/sql/THD::LOCK_thd_data
+  Cycle node 1: mutex/sql/THD::LOCK_thd_data
+  Cycle node 2: mutex/sql/LOG::LOCK_log
+  Cycle node 3: mutex/sql/LOCK_thread_count
+
+  NOTE: Cycle verified, test main.plugin, THD::~THD
+*/
+  {"mutex/sql/LOCK_thread_count", "mutex/sql/THD::LOCK_thd_data", LO_FLAG_LOOP},
+
+/*
+  Cycle loop link mutex/sql/LOCK_global_system_variables -> mutex/sql/Relay_log_info::run_lock
+  Cycle node 1: mutex/sql/Relay_log_info::run_lock
+  Cycle node 2: mutex/sql/LOCK_global_system_variables
+*/
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/LOCK_global_system_variables", 0},
+  {"mutex/sql/LOCK_global_system_variables", "mutex/sql/Relay_log_info::run_lock", LO_FLAG_LOOP},
+
+/*
+  Cycle loop link mutex/innodb/log_sys_mutex -> mutex/innodb/ibuf_mutex
+  Cycle node 1: mutex/innodb/ibuf_mutex
+  Cycle node 2: mutex/innodb/log_sys_mutex
+*/
+  {"mutex/innodb/log_sys_mutex", "mutex/innodb/ibuf_mutex", LO_FLAG_LOOP},
+
+/*
+  Cycle loop link mutex/sql/Relay_log_info::run_lock -> mutex/sql/Master_info::run_lock
+  Cycle node 1: mutex/sql/Master_info::run_lock
+  Cycle node 2: mutex/sql/Relay_log_info::run_lock
+*/
+  {"mutex/sql/Master_info::run_lock", "mutex/sql/Relay_log_info::run_lock", 0},
+  {"mutex/sql/Relay_log_info::run_lock", "mutex/sql/Master_info::run_lock", LO_FLAG_LOOP},
+
   {NULL, NULL, 0}
 };
 #endif

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-lock-order branch (marc.alff:3351 to 3352) Marc Alff1 Apr