From 2ed1383f6b2ff37fb5f72048c4d044c650d652b4 Mon Sep 17 00:00:00 2001 From: Mikael Ronstrom Date: Thu, 4 Dec 2008 16:03:02 +0100 Subject: [PATCH] call ha_release_temporary_latches to fix bug 32149 --- sql/sql_insert.cc | 3 +++ sql/sql_select.cc | 7 +++++++ storage/myisam/ha_myisam.cc | 3 +++ 3 files changed, 13 insertions(+) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 04a8db5edf0..b18b3426d42 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3065,6 +3065,9 @@ bool select_insert::send_data(List &values) DBUG_RETURN(1); } } + + // 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; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6510d2428db..94a92154389 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10526,6 +10526,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) @@ -10571,6 +10574,10 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, 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; share= *table->s; new_table.s= &share; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index b8d5a9af8d2..96905c5a6b2 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1081,6 +1081,9 @@ int ha_myisam::repair(THD *thd, MI_CHECK ¶m, bool do_optimize) 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))