#At file:///opt/local/work/trunk-runtime/ based on revid:kostja@stripped
2999 Konstantin Osipov 2010-03-19
Don't hold LOCK_open when opening a table from share:
we're protected by a metadata lock, and are not modifying the
TABLE_SHARE (almost, @todo: fix share->crashed access).
modified:
sql/sql_base.cc
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2010-03-19 10:39:08 +0000
+++ b/sql/sql_base.cc 2010-03-19 10:54:59 +0000
@@ -2914,9 +2914,11 @@ bool open_table(THD *thd, TABLE_LIST *ta
while (table_cache_count > table_cache_size && unused_tables)
free_cache_entry(unused_tables);
+ mysql_mutex_unlock(&LOCK_open);
+
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
- goto err_unlock2;
+ DBUG_RETURN(TRUE);
error= open_table_from_share(thd, share, alias,
(uint) (HA_OPEN_KEYFILE |
@@ -2931,27 +2933,29 @@ bool open_table(THD *thd, TABLE_LIST *ta
{
my_free(table, MYF(0));
- if (error == 7)
+ if (error == 7 || share->crashed)
{
+ mysql_mutex_lock(&LOCK_open);
share->version= 0;
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER);
+ mysql_mutex_unlock(&LOCK_open);
}
+
+ if (error == 7)
+ (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER);
else if (share->crashed)
- {
- share->version= 0;
(void) ot_ctx->request_backoff_action(Open_table_context::OT_REPAIR);
- }
- goto err_unlock2;
+ DBUG_RETURN(TRUE);
}
if (open_table_entry_fini(thd, share, table))
{
closefrm(table, 0);
my_free((uchar*)table, MYF(0));
- goto err_unlock2;
+ DBUG_RETURN(TRUE);
}
+ mysql_mutex_lock(&LOCK_open);
/* Add table to the share's used tables list. */
table_def_add_used_table(thd, table);
reference_table_share(share);
Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100319105459-qa2716enp8v22cj1.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk-bugfixing branch (kostja:2999) | Konstantin Osipov | 19 Mar |