On 06/23/2010 07:43 PM, Konstantin Osipov wrote:
> * Jon Olav Hauglid<Jon.Hauglid@stripped> [10/06/22 18:43]:
>> 3438 Jon Olav Hauglid 2010-06-22
>> Bug #54117 crash in thr_multi_unlock, temporary table
>
> How does this fix map to 5.5 where we have Locked_tables_list
> class?
> Let's discuss on IRC.
This is the patch I wrote for 5.5:
=== modified file 'sql/sql_table.cc'
--- sql/sql_table.cc 2010-06-17 13:31:51 +0000
+++ sql/sql_table.cc 2010-06-22 12:10:05 +0000
@@ -7331,12 +7331,22 @@ bool mysql_alter_table(THD *thd,char *ne
if (table->s->tmp_table != NO_TMP_TABLE)
{
/* Close lock if this is a transactional table */
- if (thd->lock &&
- ! (thd->locked_tables_mode == LTM_LOCK_TABLES ||
- thd->locked_tables_mode == LTM_PRELOCKED_UNDER_LOCK_TABLES))
+ if (thd->lock)
{
- mysql_unlock_tables(thd, thd->lock);
- thd->lock=0;
+ if (thd->locked_tables_mode != LTM_LOCK_TABLES &&
+ thd->locked_tables_mode != LTM_PRELOCKED_UNDER_LOCK_TABLES)
+ {
+ mysql_unlock_tables(thd, thd->lock);
+ thd->lock=0;
+ }
+ else
+ {
+ /*
+ If LOCK TABLES list is not empty and contains this table,
+ unlock the table and remove the table from this list.
+ */
+ mysql_lock_remove(thd, thd->lock, table);
+ }
}
/* Remove link to old table and rename the new one */
close_temporary_table(thd, table, 1, 1);
--- Jon Olav