-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-16142 Merge new release of InnoDB MySQL 5.7.22 to 10.2
- Loading branch information
Showing
14 changed files
with
388 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Create statement with FK on base column of stored column | ||
create table t1(f1 int, f2 int as(f1) stored, | ||
foreign key(f1) references t2(f1) on delete cascade)engine=innodb; | ||
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed") | ||
# adding new stored column during alter table copy operation. | ||
create table t1(f1 int primary key) engine=innodb; | ||
create table t2(f1 int not null, f2 int as (f1) virtual, | ||
foreign key(f1) references t1(f1) on update cascade)engine=innodb; | ||
alter table t2 add column f3 int as (f1) stored, add column f4 int as (f1) virtual; | ||
show create table t2; | ||
Table Create Table | ||
t2 CREATE TABLE `t2` ( | ||
`f1` int(11) NOT NULL, | ||
`f2` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL, | ||
`f3` int(11) GENERATED ALWAYS AS (`f1`) STORED, | ||
`f4` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL, | ||
KEY `f1` (`f1`), | ||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | ||
drop table t2; | ||
# adding foreign key constraint for base columns during alter copy. | ||
create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; | ||
alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=copy; | ||
show create table t2; | ||
Table Create Table | ||
t2 CREATE TABLE `t2` ( | ||
`f1` int(11) NOT NULL, | ||
`f2` int(11) GENERATED ALWAYS AS (`f1`) STORED, | ||
KEY `f1` (`f1`), | ||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | ||
drop table t2; | ||
# adding foreign key constraint for base columns during online alter. | ||
create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; | ||
set foreign_key_checks = 0; | ||
alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=inplace; | ||
ERROR 0A000: Cannot add foreign key on the base column of stored column | ||
drop table t2; | ||
# adding stored column via online alter. | ||
create table t2(f1 int not null, | ||
foreign key(f1) references t1(f1) on update cascade)engine=innodb; | ||
alter table t2 add column f2 int as (f1) stored, algorithm=inplace; | ||
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY | ||
drop table t2, t1; | ||
# | ||
# BUG#26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF | ||
# | ||
CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED, c INT, | ||
d INT GENERATED ALWAYS AS (0) VIRTUAL, e INT) ENGINE=innodb; | ||
CREATE TABLE t (a INT) ENGINE=innodb; | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; | ||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't' | ||
ALTER TABLE t ADD PRIMARY KEY(a); | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; | ||
DROP TABLE s,t; | ||
CREATE TABLE s (a INT GENERATED ALWAYS AS (0) VIRTUAL, | ||
b INT GENERATED ALWAYS AS (0) STORED, c INT) ENGINE=innodb; | ||
CREATE TABLE t (a INT) ENGINE=innodb; | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; | ||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't' | ||
ALTER TABLE t ADD PRIMARY KEY(a); | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; | ||
DROP TABLE s,t; | ||
CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED) ENGINE=innodb; | ||
CREATE TABLE t (a INT PRIMARY KEY) ENGINE=innodb; | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; | ||
DROP TABLE s,t; | ||
CREATE TABLE s (a INT, b INT) ENGINE=innodb; | ||
CREATE TABLE t (a INT) ENGINE=innodb; | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; | ||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't' | ||
ALTER TABLE t ADD PRIMARY KEY(a); | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; | ||
DROP TABLE s,t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--source include/have_innodb.inc | ||
|
||
--echo # Create statement with FK on base column of stored column | ||
--error ER_CANT_CREATE_TABLE | ||
create table t1(f1 int, f2 int as(f1) stored, | ||
foreign key(f1) references t2(f1) on delete cascade)engine=innodb; | ||
|
||
--echo # adding new stored column during alter table copy operation. | ||
create table t1(f1 int primary key) engine=innodb; | ||
create table t2(f1 int not null, f2 int as (f1) virtual, | ||
foreign key(f1) references t1(f1) on update cascade)engine=innodb; | ||
|
||
# MySQL 5.7 would refuse this | ||
#--error ER_ERROR_ON_RENAME | ||
alter table t2 add column f3 int as (f1) stored, add column f4 int as (f1) virtual; | ||
show create table t2; | ||
drop table t2; | ||
|
||
--echo # adding foreign key constraint for base columns during alter copy. | ||
create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; | ||
# MySQL 5.7 would refuse this | ||
alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=copy; | ||
show create table t2; | ||
drop table t2; | ||
|
||
--echo # adding foreign key constraint for base columns during online alter. | ||
create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb; | ||
set foreign_key_checks = 0; | ||
--error 138 | ||
alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=inplace; | ||
drop table t2; | ||
|
||
--echo # adding stored column via online alter. | ||
create table t2(f1 int not null, | ||
foreign key(f1) references t1(f1) on update cascade)engine=innodb; | ||
--error ER_ALTER_OPERATION_NOT_SUPPORTED | ||
alter table t2 add column f2 int as (f1) stored, algorithm=inplace; | ||
drop table t2, t1; | ||
|
||
--echo # | ||
--echo # BUG#26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF | ||
--echo # | ||
|
||
CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED, c INT, | ||
d INT GENERATED ALWAYS AS (0) VIRTUAL, e INT) ENGINE=innodb; | ||
|
||
CREATE TABLE t (a INT) ENGINE=innodb; | ||
|
||
# This would fail. No corresponding index | ||
--error ER_FK_NO_INDEX_PARENT | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
ALTER TABLE t ADD PRIMARY KEY(a); | ||
|
||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
DROP TABLE s,t; | ||
|
||
CREATE TABLE s (a INT GENERATED ALWAYS AS (0) VIRTUAL, | ||
b INT GENERATED ALWAYS AS (0) STORED, c INT) ENGINE=innodb; | ||
|
||
CREATE TABLE t (a INT) ENGINE=innodb; | ||
|
||
# This would fail. No corresponding index | ||
--error ER_FK_NO_INDEX_PARENT | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
ALTER TABLE t ADD PRIMARY KEY(a); | ||
|
||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
DROP TABLE s,t; | ||
|
||
CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED) ENGINE=innodb; | ||
|
||
CREATE TABLE t (a INT PRIMARY KEY) ENGINE=innodb; | ||
|
||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
DROP TABLE s,t; | ||
|
||
CREATE TABLE s (a INT, b INT) ENGINE=innodb; | ||
|
||
CREATE TABLE t (a INT) ENGINE=innodb; | ||
|
||
# This would fail. No corresponding index | ||
--error ER_FK_NO_INDEX_PARENT | ||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
ALTER TABLE t ADD PRIMARY KEY(a); | ||
|
||
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null; | ||
|
||
DROP TABLE s,t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Bug Bug #27304661 MYSQL CRASH DOING SYNC INDEX ] | ||
# [FATAL] INNODB: SEMAPHORE WAIT HAS LASTED > 600 | ||
# | ||
CREATE TABLE t1 ( | ||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, | ||
f1 TEXT(500), | ||
FULLTEXT idx (f1) | ||
) ENGINE=InnoDB; | ||
insert into t1 (f1) values ('fjdhfsjhf'),('dhjfhjshfj'),('dhjafjhfj'); | ||
set @save_table_definition_cache=@@global.table_definition_cache; | ||
set @save_table_open_cache=@@global.table_open_cache; | ||
set global table_definition_cache=400; | ||
set global table_open_cache= 1024; | ||
SET @save_dbug = @@GLOBAL.debug_dbug; | ||
SET GLOBAL DEBUG_DBUG="+d,crash_if_fts_table_is_evicted"; | ||
set @@global.table_definition_cache=@save_table_definition_cache; | ||
set @@global.table_open_cache=@save_table_open_cache; | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--source include/have_innodb.inc | ||
--source include/have_debug.inc | ||
--source include/big_test.inc | ||
|
||
--echo # | ||
--echo # Bug Bug #27304661 MYSQL CRASH DOING SYNC INDEX ] | ||
--echo # [FATAL] INNODB: SEMAPHORE WAIT HAS LASTED > 600 | ||
--echo # | ||
|
||
CREATE TABLE t1 ( | ||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, | ||
f1 TEXT(500), | ||
FULLTEXT idx (f1) | ||
) ENGINE=InnoDB; | ||
insert into t1 (f1) values ('fjdhfsjhf'),('dhjfhjshfj'),('dhjafjhfj'); | ||
|
||
--source include/restart_mysqld.inc | ||
|
||
set @save_table_definition_cache=@@global.table_definition_cache; | ||
set @save_table_open_cache=@@global.table_open_cache; | ||
|
||
set global table_definition_cache=400; | ||
set global table_open_cache= 1024; | ||
|
||
SET @save_dbug = @@GLOBAL.debug_dbug; | ||
SET GLOBAL DEBUG_DBUG="+d,crash_if_fts_table_is_evicted"; | ||
#Create 1000 tables, try the best to evict t1 . | ||
|
||
--disable_query_log | ||
let $loop=1000; | ||
while($loop) | ||
{ | ||
eval create table t_$loop(id int, name text(100), fulltext idxt_$loop(name) )engine=innodb; | ||
dec $loop; | ||
} | ||
|
||
let $loop=1000; | ||
while($loop) | ||
{ | ||
eval drop table t_$loop; | ||
dec $loop; | ||
} | ||
|
||
SET GLOBAL DEBUG_DBUG = @save_dbug; | ||
--enable_query_log | ||
set @@global.table_definition_cache=@save_table_definition_cache; | ||
set @@global.table_open_cache=@save_table_open_cache; | ||
drop table t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.