summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2019-10-15 20:26:40 +0300
committerMonty <monty@mariadb.org>2019-10-15 20:26:40 +0300
commit7952f7720f967b43873e4fac13583984803fae3b (patch)
treef18df36d0df0f3d800d27b3e0453f71d6d228bc7 /sql/sql_base.cc
parent4d14785546022ea8dc4e249e0b57b55328a12876 (diff)
downloadmariadb-git-7952f7720f967b43873e4fac13583984803fae3b.tar.gz
MDEV-10748 Server crashes in ha_maria::implicit_commit
Problem was in a combination of LOCK TABLES on several Aria tables followed by an ALTER TABLE. After the ALTER TABLE there was a force close + reopen of the alter table. The close failed because the table was still part of a transaction. Fixed by calling extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE) as part of closing the table, which ensures that the table is not anymore part of the current transaction.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 7276467f188..761c4daa88b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2426,9 +2426,17 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
{
if (!table_list->table || !table_list->table->needs_reopen())
continue;
- /* no need to remove the table from the TDC here, thus (TABLE*)1 */
- close_all_tables_for_name(thd, table_list->table->s,
- HA_EXTRA_NOT_USED, (TABLE*)1);
+ for (TABLE **prev= &thd->open_tables; *prev; prev= &(*prev)->next)
+ {
+ if (*prev == table_list->table)
+ {
+ thd->locked_tables_list.unlink_from_list(thd, table_list, false);
+ mysql_lock_remove(thd, thd->lock, *prev);
+ (*prev)->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
+ close_thread_table(thd, prev);
+ break;
+ }
+ }
DBUG_ASSERT(table_list->table == NULL);
}
else