* 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
> +#
> +# Bug#54117 crash in thr_multi_unlock, temporary table
> +#
> +CREATE TEMPORARY TABLE t1(a INT) ENGINE = InnoDB;
> +LOCK TABLES t1 READ;
> +ALTER TABLE t1 COMMENT 'test';
> +UNLOCK TABLES;
> +DROP TABLE t1;
> End of 5.1 tests
>
> === modified file 'sql/sql_table.cc'
> --- a/sql/sql_table.cc 2010-06-10 20:45:22 +0000
> +++ b/sql/sql_table.cc 2010-06-22 13:55:26 +0000
> @@ -7387,6 +7387,11 @@ view_err:
> mysql_unlock_tables(thd, thd->lock);
> thd->lock=0;
> }
> + /*
> + 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->locked_tables, table, FALSE);
This drops the lock on the source table, but does not
acquire a lock on the new table.
This is a violation of PSEA API -- we don't ever call
store_lock() before start_stmt on the new table.
I don't know if it's a problem.
One way to investigate is to try to work with that table a bit
after ALTER.
Perhaps a better solution for 5.5 is to make Locked_tables_list
aware of temporary tables.
--