List:Commits« Previous MessageNext Message »
From:Tatiana A. Nurnberg Date:June 4 2009 10:23pm
Subject:bzr commit into mysql-5.0-bugteam branch (azundris:2765) Bug#32149
View as plain text  
#At file:///misc/mysql/forest/32149/50-32149/ based on revid:sergey.glukhov@stripped

 2765 Tatiana A. Nurnberg	2009-06-05
      Bug#32149: Long semaphore wait for adaptive hash latch
      
      Holding on to the temporary inno hash index latch is an optimization in
      many cases, but a pessimization in some others.
      
      Release temporary latches for those corner cases we (or rather, or customers,
      thanks!) have identified, that is, when we are about to do something that
      might take a really long time, like REPAIR or filesort.
     @ sql/ha_myisam.cc
        Let go of (inno, for now) latch when doing MyISAM-repair.
        (optimize passes through repair.) ("Stuck" in "Repair with
        keycache".)
     @ sql/sql_insert.cc
        Let go of (inno, for now) latch when doing CREATE...SELECT
        in select_insert::send_data() -- it might take a while.
        ("stuck" in "Sending data")
     @ sql/sql_select.cc
        Release temporary (inno, for now) latch on
        - free_tmp_table() (this can take surprisingly long, "removing tmp table")
        - create_myisam_from_heap() (HEAP table overflowing onto disk as MyISAM,
          "converting HEAP to MyISAM")

    modified:
      sql/ha_myisam.cc
      sql/sql_insert.cc
      sql/sql_select.cc
=== modified file 'sql/ha_myisam.cc'
--- a/sql/ha_myisam.cc	2009-05-27 10:34:21 +0000
+++ b/sql/ha_myisam.cc	2009-06-04 22:23:08 +0000
@@ -1009,6 +1009,9 @@ int ha_myisam::repair(THD *thd, MI_CHECK
   param.out_flag= 0;
   strmov(fixed_name,file->filename);
 
+  // Release latches since this can take a long time
+  ha_release_temporary_latches(thd);
+
   // Don't lock tables if we have used LOCK TABLE
   if (!thd->locked_tables && 
       mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2009-05-06 13:06:32 +0000
+++ b/sql/sql_insert.cc	2009-06-04 22:23:08 +0000
@@ -2935,6 +2935,9 @@ bool select_insert::send_data(List<Item>
     }
   }
   
+  // Release latches in case bulk insert takes a long time
+  ha_release_temporary_latches(thd);
+
   error= write_record(thd, table, &info);
   table->auto_increment_field_not_null= FALSE;
   

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-05-15 09:29:41 +0000
+++ b/sql/sql_select.cc	2009-06-04 22:23:08 +0000
@@ -10226,6 +10226,9 @@ free_tmp_table(THD *thd, TABLE *entry)
   save_proc_info=thd->proc_info;
   thd_proc_info(thd, "removing tmp table");
 
+  // Release latches since this can take a long time
+  ha_release_temporary_latches(thd);
+
   if (entry->file)
   {
     if (entry->db_stat)
@@ -10274,6 +10277,10 @@ bool create_myisam_from_heap(THD *thd, T
     table->file->print_error(error,MYF(0));
     DBUG_RETURN(1);
   }
+
+  // Release latches since this can take a long time
+  ha_release_temporary_latches(thd);
+
   new_table= *table;
   new_table.s= &new_table.share_not_to_be_used;
   new_table.s->db_type= DB_TYPE_MYISAM;


Attachment: [text/bzr-bundle] bzr/azundris@mysql.com-20090604222308-ab8xhwziwraigafw.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (azundris:2765) Bug#32149Tatiana A. Nurnberg5 Jun