summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-12-09 10:42:19 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-12-09 10:42:19 +0200
commit782b2a750067a12be07b9c305ede4d2c28f173e0 (patch)
tree228deca0a3082f87e4b5b4fc0b86c0b7d0927e5c /sql
parent8f3631d0096ceecc21f2879a9558fd9242f09f8c (diff)
downloadmariadb-git-782b2a750067a12be07b9c305ede4d2c28f173e0.tar.gz
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
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_table.cc4
1 files changed, 4 insertions, 0 deletions
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