MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:April 8 2010 11:17am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3494)
Bug#48832
View as plain text  
#At file:///home/msvensson/mysql/7.0-bug48832/ based on revid:magnus.blaudd@strippedy

 3494 Magnus Blåudd	2010-04-08
      BUG#48832 Disconnection is slow when using non-persisent mysql connections
       - Optimize the common path through code for non-persistent
         connections by closing the connection to storage engine(which
         may take some time with a networked storage engine) without
         holding lock, allowing new connections to connect/disconnect
         during this time. This can be done when it's known that
         thd->cleanup() has been called already, in which case
         any transactions still active has already been rollbacked.

    modified:
      sql/mysqld.cc
      sql/sql_class.cc
      sql/sql_class.h
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-03-12 11:56:09 +0000
+++ b/sql/mysqld.cc	2010-04-08 11:17:03 +0000
@@ -1900,6 +1900,12 @@ void unlink_thd(THD *thd)
   DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
   thd->cleanup();
 
+  /*
+    Optimize common path by doing timeconsuming tear down
+    outside of global lock
+  */
+  thd->teardown();
+
   pthread_mutex_lock(&LOCK_connection_count);
   --connection_count;
   pthread_mutex_unlock(&LOCK_connection_count);

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-03-12 10:36:52 +0000
+++ b/sql/sql_class.cc	2010-04-08 11:17:03 +0000
@@ -614,6 +614,7 @@ THD::THD()
 #if defined(ENABLED_DEBUG_SYNC)
    , debug_sync_control(0)
 #endif /* defined(ENABLED_DEBUG_SYNC) */
+   , teardown_done(false)
 {
   ulong tmp;
 
@@ -978,6 +979,18 @@ void THD::cleanup(void)
 }
 
 
+void THD::teardown(void)
+{
+  DBUG_ENTER("THD::teardown");
+  DBUG_ASSERT(cleanup_done);
+
+  ha_close_connection(this);
+
+  teardown_done= true;
+  DBUG_VOID_RETURN;
+}
+
+
 THD::~THD()
 {
   THD_CHECK_SENTRY(this);
@@ -1000,7 +1013,9 @@ THD::~THD()
   if (!cleanup_done)
     cleanup();
 
-  ha_close_connection(this);
+  if (!teardown_done)
+    teardown();
+
   plugin_thdvar_cleanup(this);
 
   DBUG_PRINT("info", ("freeing security context"));

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-03-12 11:56:09 +0000
+++ b/sql/sql_class.h	2010-04-08 11:17:03 +0000
@@ -1929,6 +1929,9 @@ public:
   THD();
   ~THD();
 
+  bool teardown_done;
+  void teardown(void);
+
   void init(void);
   /*
     Initialize memory roots necessary for query processing and (!)

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20100408111703-ov9s84f2ium93ki0.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3494)Bug#48832Magnus Blåudd8 Apr
  • Re: bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3494)Bug#48832Konstantin Osipov9 Apr
    • Re: bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3494)Bug#48832Magnus Blåudd9 Apr
      • Re: bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:3494)Bug#48832Konstantin Osipov9 Apr