Skip to content

Commit fde3d89

Browse files
committed
Merge 10.2 into 10.3
2 parents 2cf489d + 78efa10 commit fde3d89

File tree

9 files changed

+56
-18
lines changed

9 files changed

+56
-18
lines changed

mysql-test/suite/encryption/r/create_or_replace.result

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
2-
SET @save_tables = @@GLOBAL.innodb_encrypt_tables;
32
SET default_storage_engine = InnoDB;
43
SET GLOBAL innodb_encryption_threads = 4;
54
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;
1817
drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
1918
table10_int_autoinc;
2019
SET GLOBAL innodb_encryption_threads = @save_threads;
21-
SET GLOBAL innodb_encrypt_tables = @save_tables;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--innodb-encrypt-tables

mysql-test/suite/encryption/t/create_or_replace.test

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
--source include/count_sessions.inc
44

55
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
6-
SET @save_tables = @@GLOBAL.innodb_encrypt_tables;
76

87
SET default_storage_engine = InnoDB;
98

@@ -76,5 +75,4 @@ drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
7675
table10_int_autoinc;
7776

7877
SET GLOBAL innodb_encryption_threads = @save_threads;
79-
SET GLOBAL innodb_encrypt_tables = @save_tables;
8078
--source include/wait_until_count_sessions.inc

mysql-test/suite/innodb/r/alter_table.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,13 @@ CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
6060
INSERT INTO t1 SELECT * FROM seq_1_to_128;
6161
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
6262
DROP TABLE t1;
63+
#
64+
# MDEV-22939 Server crashes in row_make_new_pathname()
65+
#
66+
CREATE TABLE t (a INT) ENGINE=INNODB;
67+
ALTER TABLE t DISCARD TABLESPACE;
68+
ALTER TABLE t ENGINE INNODB;
69+
ERROR HY000: Tablespace has been discarded for table `t`
70+
ALTER TABLE t FORCE;
71+
ERROR HY000: Tablespace has been discarded for table `t`
72+
DROP TABLE t;

mysql-test/suite/innodb/r/truncate.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ TRUNCATE t1;
3939
SELECT * FROM t1;
4040
a
4141
DROP TEMPORARY TABLE t1;
42+
#
43+
# MDEV-23705 Assertion 'table->data_dir_path || !space'
44+
#
45+
CREATE TABLE t(c INT) ENGINE=InnoDB;
46+
ALTER TABLE t DISCARD TABLESPACE;
47+
RENAME TABLE t TO u;
48+
TRUNCATE u;
49+
Warnings:
50+
Warning 1814 Tablespace has been discarded for table `u`
51+
TRUNCATE u;
52+
DROP TABLE u;

mysql-test/suite/innodb/t/alter_table.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,14 @@ CREATE TABLE t1(a INT NOT NULL UNIQUE) ENGINE=InnoDB;
6868
INSERT INTO t1 SELECT * FROM seq_1_to_128;
6969
ALTER TABLE t1 ADD b TINYINT AUTO_INCREMENT PRIMARY KEY, DROP KEY a;
7070
DROP TABLE t1;
71+
72+
--echo #
73+
--echo # MDEV-22939 Server crashes in row_make_new_pathname()
74+
--echo #
75+
CREATE TABLE t (a INT) ENGINE=INNODB;
76+
ALTER TABLE t DISCARD TABLESPACE;
77+
--error ER_TABLESPACE_DISCARDED
78+
ALTER TABLE t ENGINE INNODB;
79+
--error ER_TABLESPACE_DISCARDED
80+
ALTER TABLE t FORCE;
81+
DROP TABLE t;

mysql-test/suite/innodb/t/truncate.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,13 @@ INSERT INTO t1 VALUES(1);
5050
TRUNCATE t1;
5151
SELECT * FROM t1;
5252
DROP TEMPORARY TABLE t1;
53+
54+
--echo #
55+
--echo # MDEV-23705 Assertion 'table->data_dir_path || !space'
56+
--echo #
57+
CREATE TABLE t(c INT) ENGINE=InnoDB;
58+
ALTER TABLE t DISCARD TABLESPACE;
59+
RENAME TABLE t TO u;
60+
TRUNCATE u;
61+
TRUNCATE u;
62+
DROP TABLE u;

storage/innobase/dict/dict0load.cc

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,7 +2642,7 @@ static const char* dict_load_table_low(const table_name_t& name,
26422642
name.m_name, NULL, n_cols + n_v_col, n_v_col, flags, flags2);
26432643
(*table)->space_id = space_id;
26442644
(*table)->id = table_id;
2645-
(*table)->file_unreadable = false;
2645+
(*table)->file_unreadable = !!(flags2 & DICT_TF2_DISCARDED);
26462646

26472647
return(NULL);
26482648
}
@@ -2696,20 +2696,14 @@ dict_get_and_save_data_dir_path(
26962696
ut_ad(!table->is_temporary());
26972697
ut_ad(!table->space || table->space->id == table->space_id);
26982698

2699-
if (!table->data_dir_path && table->space_id) {
2699+
if (!table->data_dir_path && table->space_id && table->space) {
27002700
if (!dict_mutex_own) {
27012701
dict_mutex_enter_for_mysql();
27022702
}
27032703

2704-
if (const char* p = table->space
2705-
? table->space->chain.start->name : NULL) {
2706-
table->flags |= (1 << DICT_TF_POS_DATA_DIR);
2707-
dict_save_data_dir_path(table, p);
2708-
} else if (char* path = dict_get_first_path(table->space_id)) {
2709-
table->flags |= (1 << DICT_TF_POS_DATA_DIR);
2710-
dict_save_data_dir_path(table, path);
2711-
ut_free(path);
2712-
}
2704+
table->flags |= (1 << DICT_TF_POS_DATA_DIR);
2705+
dict_save_data_dir_path(table,
2706+
table->space->chain.start->name);
27132707

27142708
if (table->data_dir_path == NULL) {
27152709
/* Since we did not set the table data_dir_path,

storage/innobase/handler/handler0alter.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9560,9 +9560,14 @@ ha_innobase::commit_inplace_alter_table(
95609560
= static_cast<ha_innobase_inplace_ctx*>(*pctx);
95619561

95629562
DBUG_ASSERT(new_clustered == ctx->need_rebuild());
9563-
9564-
fail = commit_set_autoinc(ha_alter_info, ctx, altered_table,
9565-
table);
9563+
if (ctx->need_rebuild() && !ctx->old_table->space) {
9564+
my_error(ER_TABLESPACE_DISCARDED, MYF(0),
9565+
table->s->table_name.str);
9566+
fail = true;
9567+
} else {
9568+
fail = commit_set_autoinc(ha_alter_info, ctx,
9569+
altered_table, table);
9570+
}
95669571

95679572
if (fail) {
95689573
} else if (ctx->need_rebuild()) {

0 commit comments

Comments
 (0)