Commit fde3d895 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into 10.3

parents 2cf489d4 78efa109
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;
......@@ -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
......@@ -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;
......@@ -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;
......@@ -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;
......@@ -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;
......@@ -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,
......
......@@ -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()) {
......
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