summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-22 14:33:03 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-22 14:33:03 +0300
commitfde3d895d9dca494be9fa077835fb2f606a5f3d0 (patch)
tree88d575fb32e849aad9ce33bba064593d02613f7a
parent2cf489d4305227115177b435ec536fe8f84daa6b (diff)
parent78efa1093076307946873f322b45a14d1ed5ffb0 (diff)
downloadmariadb-git-fde3d895d9dca494be9fa077835fb2f606a5f3d0.tar.gz
Merge 10.2 into 10.3
-rw-r--r--mysql-test/suite/encryption/r/create_or_replace.result2
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.opt1
-rw-r--r--mysql-test/suite/encryption/t/create_or_replace.test2
-rw-r--r--mysql-test/suite/innodb/r/alter_table.result10
-rw-r--r--mysql-test/suite/innodb/r/truncate.result11
-rw-r--r--mysql-test/suite/innodb/t/alter_table.test11
-rw-r--r--mysql-test/suite/innodb/t/truncate.test10
-rw-r--r--storage/innobase/dict/dict0load.cc16
-rw-r--r--storage/innobase/handler/handler0alter.cc11
9 files changed, 56 insertions, 18 deletions
diff --git a/mysql-test/suite/encryption/r/create_or_replace.result b/mysql-test/suite/encryption/r/create_or_replace.result
index 62dac4ccc43..69ea113289b 100644
--- a/mysql-test/suite/encryption/r/create_or_replace.result
+++ b/mysql-test/suite/encryption/r/create_or_replace.result
@@ -1,5 +1,4 @@
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
-SET @save_tables = @@GLOBAL.innodb_encrypt_tables;
SET default_storage_engine = InnoDB;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
@@ -18,4 +17,3 @@ connection default;
drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
table10_int_autoinc;
SET GLOBAL innodb_encryption_threads = @save_threads;
-SET GLOBAL innodb_encrypt_tables = @save_tables;
diff --git a/mysql-test/suite/encryption/t/create_or_replace.opt b/mysql-test/suite/encryption/t/create_or_replace.opt
new file mode 100644
index 00000000000..66892f34897
--- /dev/null
+++ b/mysql-test/suite/encryption/t/create_or_replace.opt
@@ -0,0 +1 @@
+--innodb-encrypt-tables
diff --git a/mysql-test/suite/encryption/t/create_or_replace.test b/mysql-test/suite/encryption/t/create_or_replace.test
index 8d571794713..2ebd599d460 100644
--- a/mysql-test/suite/encryption/t/create_or_replace.test
+++ b/mysql-test/suite/encryption/t/create_or_replace.test
@@ -3,7 +3,6 @@
--source include/count_sessions.inc
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
-SET @save_tables = @@GLOBAL.innodb_encrypt_tables;
SET default_storage_engine = InnoDB;
@@ -76,5 +75,4 @@ drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
table10_int_autoinc;
SET GLOBAL innodb_encryption_threads = @save_threads;
-SET GLOBAL innodb_encrypt_tables = @save_tables;
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/innodb/r/alter_table.result b/mysql-test/suite/innodb/r/alter_table.result
index 94262ac29c3..fc08f29e515 100644
--- a/mysql-test/suite/innodb/r/alter_table.result
+++ b/mysql-test/suite/innodb/r/alter_table.result
@@ -60,3 +60,13 @@ CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_128;
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
DROP TABLE t1;
+#
+# MDEV-22939 Server crashes in row_make_new_pathname()
+#
+CREATE TABLE t (a INT) ENGINE=INNODB;
+ALTER TABLE t DISCARD TABLESPACE;
+ALTER TABLE t ENGINE INNODB;
+ERROR HY000: Tablespace has been discarded for table `t`
+ALTER TABLE t FORCE;
+ERROR HY000: Tablespace has been discarded for table `t`
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/truncate.result b/mysql-test/suite/innodb/r/truncate.result
index 0e5ffeea34f..180414f47c7 100644
--- a/mysql-test/suite/innodb/r/truncate.result
+++ b/mysql-test/suite/innodb/r/truncate.result
@@ -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;
diff --git a/mysql-test/suite/innodb/t/alter_table.test b/mysql-test/suite/innodb/t/alter_table.test
index 6bc30d2e8ee..5050abdc087 100644
--- a/mysql-test/suite/innodb/t/alter_table.test
+++ b/mysql-test/suite/innodb/t/alter_table.test
@@ -68,3 +68,14 @@ CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 SELECT * FROM seq_1_to_128;
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-22939 Server crashes in row_make_new_pathname()
+--echo #
+CREATE TABLE t (a INT) ENGINE=INNODB;
+ALTER TABLE t DISCARD TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+ALTER TABLE t ENGINE INNODB;
+--error ER_TABLESPACE_DISCARDED
+ALTER TABLE t FORCE;
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/truncate.test b/mysql-test/suite/innodb/t/truncate.test
index cd1d827e157..ca9ccb677e9 100644
--- a/mysql-test/suite/innodb/t/truncate.test
+++ b/mysql-test/suite/innodb/t/truncate.test
@@ -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;
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index f530f7f6268..386b99bcaad 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -2642,7 +2642,7 @@ static const char* dict_load_table_low(const table_name_t& name,
name.m_name, NULL, n_cols + n_v_col, n_v_col, flags, flags2);
(*table)->space_id = space_id;
(*table)->id = table_id;
- (*table)->file_unreadable = false;
+ (*table)->file_unreadable = !!(flags2 & DICT_TF2_DISCARDED);
return(NULL);
}
@@ -2696,20 +2696,14 @@ dict_get_and_save_data_dir_path(
ut_ad(!table->is_temporary());
ut_ad(!table->space || table->space->id == table->space_id);
- if (!table->data_dir_path && table->space_id) {
+ if (!table->data_dir_path && table->space_id && table->space) {
if (!dict_mutex_own) {
dict_mutex_enter_for_mysql();
}
- if (const char* p = table->space
- ? table->space->chain.start->name : NULL) {
- table->flags |= (1 << DICT_TF_POS_DATA_DIR);
- dict_save_data_dir_path(table, p);
- } else if (char* path = dict_get_first_path(table->space_id)) {
- table->flags |= (1 << DICT_TF_POS_DATA_DIR);
- dict_save_data_dir_path(table, path);
- ut_free(path);
- }
+ table->flags |= (1 << DICT_TF_POS_DATA_DIR);
+ dict_save_data_dir_path(table,
+ table->space->chain.start->name);
if (table->data_dir_path == NULL) {
/* Since we did not set the table data_dir_path,
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index c1111a5558d..e55eda2d331 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -9560,9 +9560,14 @@ ha_innobase::commit_inplace_alter_table(
= static_cast<ha_innobase_inplace_ctx*>(*pctx);
DBUG_ASSERT(new_clustered == ctx->need_rebuild());
-
- fail = commit_set_autoinc(ha_alter_info, ctx, altered_table,
- table);
+ if (ctx->need_rebuild() && !ctx->old_table->space) {
+ my_error(ER_TABLESPACE_DISCARDED, MYF(0),
+ table->s->table_name.str);
+ fail = true;
+ } else {
+ fail = commit_set_autoinc(ha_alter_info, ctx,
+ altered_table, table);
+ }
if (fail) {
} else if (ctx->need_rebuild()) {