Commit 732cd7fd authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23705 Assertion 'table->data_dir_path || !space'

After DISCARD TABLESPACE, the tablespace of a table will no longer
exist, and dict_get_and_save_data_dir_path() would invoke
dict_get_first_path() to read an entry from SYS_DATAFILES.
For some reason, DISCARD TABLESPACE would not to remove the entry
from there.

dict_get_and_save_data_dir_path(): If the tablespace has been
discarded, do not bother trying to read the name.

Side note: The tables SYS_TABLESPACES and SYS_DATAFILES are
redundant and subject to removal in MDEV-22343.
parent eb38b1f7
......@@ -39,3 +39,14 @@ TRUNCATE t1;
SELECT * FROM t1;
a
DROP TEMPORARY TABLE t1;
#
# MDEV-23705 Assertion 'table->data_dir_path || !space'
#
CREATE TABLE t(c INT) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
RENAME TABLE t TO u;
TRUNCATE u;
Warnings:
Warning 1814 Tablespace has been discarded for table `u`
TRUNCATE u;
DROP TABLE u;
......@@ -50,3 +50,13 @@ INSERT INTO t1 VALUES(1);
TRUNCATE t1;
SELECT * FROM t1;
DROP TEMPORARY TABLE t1;
--echo #
--echo # MDEV-23705 Assertion 'table->data_dir_path || !space'
--echo #
CREATE TABLE t(c INT) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
RENAME TABLE t TO u;
TRUNCATE u;
TRUNCATE u;
DROP TABLE u;
......@@ -2739,7 +2739,8 @@ dict_get_and_save_data_dir_path(
{
ut_ad(!dict_table_is_temporary(table));
if (!table->data_dir_path && table->space) {
if (!table->data_dir_path && table->space
&& !dict_table_is_discarded(table)) {
char* path = fil_space_get_first_path(table->space);
if (!dict_mutex_own) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment