From cc86360f4afb5b7b9fe64bbffef18538b2e3589b Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Thu, 1 Dec 2022 16:34:17 +0300 Subject: MDEV-30112 ASAN errors in Item_ident::print / generate_partition_syntax Like in MDEV-16110 we must release items allocated on thd->mem_root by reopening the table. MDEV-16290 relocated MDEV-16110 fix in 10.5 so it works for MDEV-28576 as well. 10.3 without MDEV-16290 now duplicates this fix. --- sql/sql_table.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 413d78ae814..042ed9e1d6f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8328,6 +8328,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } /* if (def->change.str) */ } /* while (def) */ } /* if (part_field_list || subpart_field_list) */ + // Force reopen because new column name is on thd->mem_root + table->mark_table_for_reopen(); } /* if (part_info) */ } #endif -- cgit v1.2.1 From 782b2a750067a12be07b9c305ede4d2c28f173e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 9 Dec 2022 10:42:19 +0200 Subject: MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORT mysql_discard_or_import_tablespace(): On successful ALTER TABLE...DISCARD TABLESPACE, evict the table handle from the table definition cache, so that ha_innobase::close() will be invoked, like InnoDB expects to be the case. This will avoid an assertion failure ut_a(table->get_ref_count() == 0) during IMPORT TABLESPACE. ha_innobase::open(): Do not issue any ER_TABLESPACE_DISCARDED warning. Member functions for DML will do that. ha_innobase::truncate(), ha_innobase::check_if_supported_inplace_alter(): Issue ER_TABLESPACE_DISCARDED warnings, to compensate for the removal of the warning in ha_innobase::open(). row_quiesce_write_indexes(): Only write information about committed indexes. The ALTER TABLE t NOWAIT ADD INDEX(c) in the nondeterministic test case will most of the time fail due to a metadata lock (MDL) timeout and leave behind an uncommitted index. Reviewed by: Sergei Golubchik --- sql/sql_table.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 042ed9e1d6f..62a46dbf430 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6075,6 +6075,10 @@ int mysql_discard_or_import_tablespace(THD *thd, if (unlikely(error)) goto err; + if (discard) + tdc_remove_table(thd, TDC_RT_REMOVE_NOT_OWN, table_list->table->s->db.str, + table_list->table->s->table_name.str, true); + /* The 0 in the call below means 'not in a transaction', which means immediate invalidation; that is probably what we wish here -- cgit v1.2.1