MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:marc.alff Date:August 30 2007 12:56am
Subject:bk commit into 5.1 tree (malff:1.2585) BUG#30712
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of marcsql. When marcsql does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-29 18:56:00-06:00, malff@weblab.(none) +2 -0
  Bug#30712 (open_performance_schema_table() cause an open table leak on
  failures)
  
  Fixed open_performance_schema_table() and close_performance_schema_table()
  implementation and callers, to always execute balanced calls to:
    thd->reset_n_backup_open_tables_state(backup);
    thd->restore_backup_open_tables_state(backup);
  

  sql/log.cc@stripped, 2007-08-29 18:55:55-06:00, malff@weblab.(none) +8 -2
    Balanced calls to reset_n_backup_open_tables_state() / restore_backup_open_tables_state()

  sql/sql_base.cc@stripped, 2007-08-29 18:55:55-06:00, malff@weblab.(none) +21 -17
    Balanced calls to reset_n_backup_open_tables_state() / restore_backup_open_tables_state()

diff -Nrup a/sql/log.cc b/sql/log.cc
--- a/sql/log.cc	2007-08-17 02:18:54 -06:00
+++ b/sql/log.cc	2007-08-29 18:55:55 -06:00
@@ -656,8 +656,14 @@ int Log_to_csv_event_handler::
 
   table= open_performance_schema_table(thd, & table_list,
                                        & open_tables_backup);
-  result= (table ? 0 : 1);
-  close_performance_schema_table(thd, & open_tables_backup);
+  if (table)
+  {
+    result= 0;
+    close_performance_schema_table(thd, & open_tables_backup);
+  }
+  else
+    result= 1;
+
   DBUG_RETURN(result);
 }
 
diff -Nrup a/sql/sql_base.cc b/sql/sql_base.cc
--- a/sql/sql_base.cc	2007-08-20 16:11:42 -06:00
+++ b/sql/sql_base.cc	2007-08-29 18:55:55 -06:00
@@ -7746,6 +7746,9 @@ open_performance_schema_table(THD *thd, 
     */
     table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
   }
+  else
+    thd->restore_backup_open_tables_state(backup);
+
   thd->utime_after_lock= save_utime_after_lock;
   DBUG_RETURN(table);
 }
@@ -7761,24 +7764,25 @@ void close_performance_schema_table(THD 
 {
   bool found_old_table;
 
-  if (thd->lock)
-  {
-    /*
-      Note:
-      We do not create explicitly a separate transaction for the
-      performance table I/O, but borrow the current transaction.
-      lock + unlock will autocommit the change done in the
-      performance schema table: this is the expected result.
-      The current transaction should not be affected by this code.
-      TODO: Note that if a transactional engine is used for log tables,
-      this code will need to be revised, as a separate transaction
-      might be needed.
-    */
-    mysql_unlock_tables(thd, thd->lock);
-    thd->lock= 0;
-  }
+  /*
+    If open_performance_schema_table() fails,
+    this function should not be called.
+  */
+  DBUG_ASSERT(thd->lock != NULL);
 
-  safe_mutex_assert_not_owner(&LOCK_open);
+  /*
+    Note:
+    We do not create explicitly a separate transaction for the
+    performance table I/O, but borrow the current transaction.
+    lock + unlock will autocommit the change done in the
+    performance schema table: this is the expected result.
+    The current transaction should not be affected by this code.
+    TODO: Note that if a transactional engine is used for log tables,
+    this code will need to be revised, as a separate transaction
+    might be needed.
+  */
+  mysql_unlock_tables(thd, thd->lock);
+  thd->lock= 0;
 
   pthread_mutex_lock(&LOCK_open);
 
Thread
bk commit into 5.1 tree (malff:1.2585) BUG#30712marc.alff30 Aug
  • Re: bk commit into 5.1 tree (malff:1.2585) BUG#30712Konstantin Osipov30 Aug