From: Marc Alff Date: September 20 2011 5:24pm Subject: bzr push into mysql-trunk branch (marc.alff:3418 to 3419) List-Archive: http://lists.mysql.com/commits/141036 Message-Id: <201109201724.p8KHOu8o007883@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3419 Marc Alff 2011-09-20 Moved table io unbind / rebind calls outside of the LOCK_open critical section modified: sql/sql_base.cc 3418 Jonathan Perkin 2011-09-20 [merge] Merge from mysql-5.5 modified: cmake/mysql_version.cmake support-files/mysql.spec.sh === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2011-09-14 15:03:55 +0000 +++ b/sql/sql_base.cc 2011-09-20 17:24:16 +0000 @@ -560,7 +560,6 @@ static void table_def_unuse_table(TABLE DBUG_ASSERT(! table->s->has_old_version()); table->in_use= 0; - table->file->unbind_psi(); /* Remove table from the list of tables used in this share. */ table->s->used_tables.remove(table); @@ -1655,6 +1654,10 @@ bool close_thread_table(THD *thd, TABLE table->file->ha_reset(); } + /* Do this *before* entering the LOCK_open critical section. */ + if (table->file != NULL) + table->file->unbind_psi(); + mysql_mutex_lock(&LOCK_open); if (table->s->has_old_version() || table->needs_reopen() || @@ -2731,6 +2734,8 @@ bool open_table(THD *thd, TABLE_LIST *ta int error; TABLE_SHARE *share; my_hash_value_type hash_value; + bool recycled_free_table; + DBUG_ENTER("open_table"); /* @@ -3088,6 +3093,7 @@ retry_share: { table= share->free_tables.front(); table_def_use_table(thd, table); + recycled_free_table= true; /* We need to release share as we have EXTRA reference to it in our hands. */ release_table_share(share); } @@ -3099,6 +3105,7 @@ retry_share: mysql_mutex_unlock(&LOCK_open); + recycled_free_table= false; /* make a new table */ if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME)))) goto err_lock; @@ -3140,6 +3147,10 @@ retry_share: mysql_mutex_unlock(&LOCK_open); + /* Call rebind_psi outside of the LOCK_open critical section. */ + if (recycled_free_table) + table->file->rebind_psi(); + table->mdl_ticket= mdl_ticket; table->next= thd->open_tables; /* Link into simple list */ No bundle (reason: useless for push emails).