MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:April 29 2008 2:22pm
Subject:bk commit into 6.0 tree (anozdrin:1.2613) BUG#35395
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of anozdrin.  When anozdrin 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, 2008-04-29 18:22:41+04:00, anozdrin@stripped +1 -0
  A fix for Bug#35395: Object services for enumerating view
  dependencies make server deadlock.
  
  The problem was that ViewBaseObjectsIterator::create() method opened
  a view and its underlying tables in order to get a list of all
  the tables on which view depends without closing them afterwards.
  This happened due to false assumption that THD::~THD() closes all
  the tables which were open for THD object being destroyed.
  
  The fix is to call close_thread_tables() explicitly. Also, since
  we're interested only in meta-data, there is no need to lock tables.
  So, open_tables() can be used instead of open_and_lock_tables().
  
  A test case is not provided because there is no easy way to test
  this without changing the source code.

  sql/si_objects.cc@stripped, 2008-04-29 18:22:40+04:00, anozdrin@stripped +4 -1
    1. Use open_tables() instead of open_and_lock_tables().
    2. Explicitly close open tables.

diff -Nrup a/sql/si_objects.cc b/sql/si_objects.cc
--- a/sql/si_objects.cc	2008-04-24 13:18:47 +04:00
+++ b/sql/si_objects.cc	2008-04-29 18:22:40 +04:00
@@ -1318,6 +1318,7 @@ ViewBaseObjectsIterator::create(THD *thd
                                const String *view_name,
                                IteratorType iterator_type)
 {
+  uint table_count; // Passed to open_tables(). Not used.
   THD *my_thd= new THD();
 
   my_thd->security_ctx= thd->security_ctx;
@@ -1333,8 +1334,9 @@ ViewBaseObjectsIterator::create(THD *thd
                            ((String *) view_name)->c_ptr_safe(),
                            TL_READ);
 
-  if (open_and_lock_tables(my_thd, tl))
+  if (open_tables(my_thd, &tl, &table_count, 0))
   {
+    close_thread_tables(my_thd);
     delete my_thd;
     thd->store_globals();
 
@@ -1376,6 +1378,7 @@ ViewBaseObjectsIterator::create(THD *thd
     }
   }
 
+  close_thread_tables(my_thd);
   delete my_thd;
 
   thd->store_globals();
Thread
bk commit into 6.0 tree (anozdrin:1.2613) BUG#35395Alexander Nozdrin29 Apr