[Commits] Rev 3461: MDEV-26: Global transaction ID in http://bazaar.launchpad.net/~maria-captains/maria/10.0

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Mon Feb 25 19:03:31 EET 2013


At http://bazaar.launchpad.net/~maria-captains/maria/10.0

------------------------------------------------------------
revno: 3461
revision-id: knielsen at knielsen-hq.org-20130225170330-scqav24yhkfrqxh4
parent: knielsen at knielsen-hq.org-20130222113155-cc1dgyi6t5hjnrui
committer: knielsen at knielsen-hq.org
branch nick: work-10.0-mdev26
timestamp: Mon 2013-02-25 18:03:30 +0100
message:
  MDEV-26: Global transaction ID
  
  Fix lock order violation. Make sure we temporarily release
  LOCK_global_system_variables before taking LOCK_active_mi.
  Otherwise we get a lock dependency cycle when we use
  open_tables() under LOCK_active_mi.
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-11-07 13:18:10 +0000
+++ b/sql/mysqld.cc	2013-02-25 17:03:30 +0000
@@ -3896,6 +3896,7 @@ static int init_thread_environment()
   mysql_mutex_init(key_LOCK_active_mi, &LOCK_active_mi, MY_MUTEX_INIT_FAST);
   mysql_mutex_init(key_LOCK_global_system_variables,
                    &LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
+  mysql_mutex_record_order(&LOCK_active_mi, &LOCK_global_system_variables);
   mysql_rwlock_init(key_rwlock_LOCK_system_variables_hash,
                     &LOCK_system_variables_hash);
   mysql_mutex_init(key_LOCK_prepared_stmt_count,

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2012-10-23 10:46:29 +0000
+++ b/sql/sql_base.cc	2013-02-25 17:03:30 +0000
@@ -378,6 +378,7 @@ bool table_def_init(void)
   init_tdc_psi_keys();
 #endif
   mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
+  mysql_mutex_record_order(&LOCK_active_mi, &LOCK_open);
   oldest_unused_share= &end_of_unused_share;
   end_of_unused_share.prev= &oldest_unused_share;
 

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2012-10-23 10:46:29 +0000
+++ b/sql/sys_vars.cc	2013-02-25 17:03:30 +0000
@@ -3397,6 +3397,7 @@ get_master_info_uint_value(THD *thd, ptr
 {
   Master_info *mi;
   uint res= 0;                                  // Default value
+  mysql_mutex_unlock(&LOCK_global_system_variables);
   mysql_mutex_lock(&LOCK_active_mi);
   mi= master_info_index->
     get_master_info(&thd->variables.default_master_connection,
@@ -3408,6 +3409,7 @@ get_master_info_uint_value(THD *thd, ptr
     mysql_mutex_unlock(&mi->rli.data_lock);
   }
   mysql_mutex_unlock(&LOCK_active_mi);    
+  mysql_mutex_lock(&LOCK_global_system_variables);
   return res;
 }
   
@@ -3419,6 +3421,7 @@ bool update_multi_source_variable(sys_va
   bool result= true;
   Master_info *mi;
 
+  mysql_mutex_unlock(&LOCK_global_system_variables);
   mysql_mutex_lock(&LOCK_active_mi);
   mi= master_info_index->
     get_master_info(&thd->variables.default_master_connection,
@@ -3432,6 +3435,7 @@ bool update_multi_source_variable(sys_va
     mysql_mutex_unlock(&mi->rli.run_lock);
   }
   mysql_mutex_unlock(&LOCK_active_mi);
+  mysql_mutex_lock(&LOCK_global_system_variables);
   return result;
 }
 



More information about the commits mailing list