Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
566 additions
and
70 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
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,61 @@ | ||
SET NAMES utf8; | ||
CREATE TABLE ① ( | ||
c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) | ||
ENGINE = InnoDB; | ||
CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2), | ||
CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES ①(c2)) | ||
ENGINE=InnoDB; | ||
INSERT INTO ① SET c1 = 1; | ||
SET @saved_debug_dbug = @@SESSION.debug_dbug; | ||
SET DEBUG_DBUG = '+d,ib_drop_foreign_error'; | ||
ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ②; | ||
ERROR HY000: The table 't1ć' is full | ||
SET DEBUG_DBUG = @saved_debug_dbug; | ||
SET DEBUG_DBUG = '+d,ib_rename_column_error'; | ||
ALTER TABLE ① CHANGE c2 š INT; | ||
ERROR HY000: The table '①' is full | ||
SET DEBUG_DBUG = @saved_debug_dbug; | ||
SHOW CREATE TABLE t1ć; | ||
Table Create Table | ||
t1ć CREATE TABLE `t1ć` ( | ||
`c1` int(11) NOT NULL, | ||
`c2` int(11) DEFAULT NULL, | ||
PRIMARY KEY (`c1`), | ||
KEY `c2` (`c2`), | ||
CONSTRAINT `t1c2` FOREIGN KEY (`c2`) REFERENCES `①` (`c2`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | ||
DROP TABLE t1ć, ①; | ||
# | ||
# Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL | ||
# WITH INCORRECT KEY NAME | ||
create table t1 (id int auto_increment primary key, a int, unique key uk(a)) | ||
engine = innodb; | ||
insert into t1 select 1, 1; | ||
insert into t1 select 2, 2; | ||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; | ||
alter table t1 add b int, ALGORITHM=inplace; | ||
/* connection con1 */ | ||
connect con1,localhost,root,,; | ||
SET DEBUG_SYNC = 'now WAIT_FOR s1'; | ||
insert into t1 select NULL, 1; | ||
ERROR 23000: Duplicate entry '1' for key 'uk' | ||
SET DEBUG_SYNC = 'now SIGNAL s2'; | ||
/* connection default */ | ||
connection default; | ||
/* reap */ alter table t1 add b int, ALGORITHM=inplace; | ||
ERROR 23000: Duplicate entry '1' for key 'uk' | ||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; | ||
alter table t1 add b int, ALGORITHM=inplace;; | ||
/* connection con1 */ | ||
connection con1; | ||
set DEBUG_SYNC = 'now WAIT_FOR s1'; | ||
update t1 set a=1 where id=2; | ||
ERROR 23000: Duplicate entry '1' for key 'uk' | ||
SET DEBUG_SYNC = 'now SIGNAL s2'; | ||
disconnect con1; | ||
/* connection default */ | ||
connection default; | ||
/* reap */ alter table t1 add b int, ALGORITHM=inplace; | ||
ERROR 23000: Duplicate entry '1' for key 'uk' | ||
SET DEBUG_SYNC = 'RESET'; | ||
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,59 @@ | ||
CREATE TABLE t (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 INT) ENGINE=InnoDB; | ||
INSERT INTO t VALUES (1,2,3),(4,5,6),(7,8,9); | ||
ALTER TABLE t CHANGE c1 c1 INT NULL FIRST, ALGORITHM=INPLACE; | ||
affected rows: 0 | ||
info: Records: 0 Duplicates: 0 Warnings: 0 | ||
set @old_sql_mode = @@sql_mode; | ||
set @@sql_mode = 'STRICT_TRANS_TABLES'; | ||
ALTER TABLE t MODIFY c3 INT NOT NULL, ALGORITHM=INPLACE; | ||
affected rows: 0 | ||
info: Records: 0 Duplicates: 0 Warnings: 0 | ||
set @@sql_mode = @old_sql_mode; | ||
ALTER TABLE t CHANGE c2 c2 INT, CHANGE c2 c2 INT NOT NULL; | ||
ERROR 42S22: Unknown column 'c2' in 't' | ||
ALTER TABLE t MODIFY c2 INT, MODIFY c2 INT NOT NULL; | ||
ERROR 42S22: Unknown column 'c2' in 't' | ||
ALTER TABLE t MODIFY c2 INT UNSIGNED, MODIFY c2 INT; | ||
ERROR 42S22: Unknown column 'c2' in 't' | ||
ALTER TABLE t MODIFY c2 CHAR(1) NOT NULL, MODIFY c2 INT NOT NULL; | ||
ERROR 42S22: Unknown column 'c2' in 't' | ||
ALTER TABLE t CHANGE c2 c2 INT NOT NULL; | ||
affected rows: 0 | ||
info: Records: 0 Duplicates: 0 Warnings: 0 | ||
ALTER TABLE t MODIFY c2 INT NOT NULL; | ||
affected rows: 0 | ||
info: Records: 0 Duplicates: 0 Warnings: 0 | ||
connect con1,localhost,root,,; | ||
connection con1; | ||
SET SQL_MODE='STRICT_ALL_TABLES'; | ||
UPDATE t SET c2=NULL; | ||
ERROR 23000: Column 'c2' cannot be null | ||
SELECT * FROM t; | ||
c1 c2 c3 | ||
1 2 3 | ||
4 5 6 | ||
7 8 9 | ||
connection default; | ||
ALTER TABLE t MODIFY c2 INT, ALGORITHM=INPLACE; | ||
connection con1; | ||
BEGIN; | ||
UPDATE t SET c2=NULL; | ||
SELECT * FROM t; | ||
c1 c2 c3 | ||
1 NULL 3 | ||
4 NULL 6 | ||
7 NULL 9 | ||
ROLLBACK; | ||
SELECT * FROM t; | ||
c1 c2 c3 | ||
1 2 3 | ||
4 5 6 | ||
7 8 9 | ||
disconnect con1; | ||
connection default; | ||
ALTER TABLE t MODIFY c2 INT NULL, ALGORITHM=INPLACE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES | ||
WHERE NAME='test/t'; | ||
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE | ||
# test/t 33 6 # Barracuda Dynamic 0 Single | ||
DROP TABLE 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,29 @@ | ||
SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment; | ||
SET GLOBAL innodb_defragment = 1; | ||
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256), KEY(a, b)) ENGINE=INNODB; | ||
OPTIMIZE TABLE t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 optimize status OK | ||
INSERT INTO t1 VALUES (100000, REPEAT('A', 256)); | ||
INSERT INTO t1 VALUES (200000, REPEAT('A', 256)); | ||
INSERT INTO t1 VALUES (300000, REPEAT('A', 256)); | ||
INSERT INTO t1 VALUES (400000, REPEAT('A', 256)); | ||
OPTIMIZE TABLE t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 optimize status OK | ||
DROP TABLE t1; | ||
# | ||
# MDEV-12198 innodb_defragment=1 crashes server on | ||
# OPTIMIZE TABLE when FULLTEXT index exists | ||
# | ||
CREATE TABLE t1 (c TEXT, FULLTEXT KEY (c)) ENGINE=InnoDB; | ||
OPTIMIZE TABLE t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 optimize status OK | ||
DROP TABLE t1; | ||
CREATE TABLE t1 (c POINT PRIMARY KEY, SPATIAL INDEX(c)) ENGINE=InnoDB; | ||
OPTIMIZE TABLE t1; | ||
Table Op Msg_type Msg_text | ||
test.t1 optimize status OK | ||
DROP TABLE t1; | ||
SET GLOBAL innodb_defragment = @innodb_defragment_orig; |
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,79 @@ | ||
--source include/have_innodb.inc | ||
--source include/have_debug.inc | ||
--source include/have_debug_sync.inc | ||
|
||
--source include/count_sessions.inc | ||
|
||
SET NAMES utf8; | ||
|
||
CREATE TABLE ① ( | ||
c1 INT PRIMARY KEY, c2 INT DEFAULT 1, ct TEXT, INDEX(c2)) | ||
ENGINE = InnoDB; | ||
|
||
CREATE TABLE t1ć (c1 INT PRIMARY KEY, c2 INT, INDEX(c2), | ||
CONSTRAINT t1c2 FOREIGN KEY (c2) REFERENCES ①(c2)) | ||
ENGINE=InnoDB; | ||
|
||
INSERT INTO ① SET c1 = 1; | ||
|
||
SET @saved_debug_dbug = @@SESSION.debug_dbug; | ||
SET DEBUG_DBUG = '+d,ib_drop_foreign_error'; | ||
--error ER_RECORD_FILE_FULL | ||
ALTER TABLE t1ć DROP FOREIGN KEY t1c2, RENAME TO ②; | ||
SET DEBUG_DBUG = @saved_debug_dbug; | ||
|
||
SET DEBUG_DBUG = '+d,ib_rename_column_error'; | ||
--error ER_RECORD_FILE_FULL | ||
ALTER TABLE ① CHANGE c2 š INT; | ||
SET DEBUG_DBUG = @saved_debug_dbug; | ||
|
||
SHOW CREATE TABLE t1ć; | ||
|
||
DROP TABLE t1ć, ①; | ||
|
||
--echo # | ||
--echo # Bug #21364096 THE BOGUS DUPLICATE KEY ERROR IN ONLINE DDL | ||
--echo # WITH INCORRECT KEY NAME | ||
|
||
create table t1 (id int auto_increment primary key, a int, unique key uk(a)) | ||
engine = innodb; | ||
insert into t1 select 1, 1; | ||
insert into t1 select 2, 2; | ||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; | ||
--send alter table t1 add b int, ALGORITHM=inplace | ||
|
||
--echo /* connection con1 */ | ||
connect (con1,localhost,root,,); | ||
SET DEBUG_SYNC = 'now WAIT_FOR s1'; | ||
--error ER_DUP_ENTRY | ||
insert into t1 select NULL, 1; | ||
SET DEBUG_SYNC = 'now SIGNAL s2'; | ||
|
||
--echo /* connection default */ | ||
connection default; | ||
--echo /* reap */ alter table t1 add b int, ALGORITHM=inplace; | ||
--error ER_DUP_ENTRY | ||
--reap | ||
|
||
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; | ||
--send alter table t1 add b int, ALGORITHM=inplace; | ||
|
||
--echo /* connection con1 */ | ||
connection con1; | ||
set DEBUG_SYNC = 'now WAIT_FOR s1'; | ||
--error ER_DUP_ENTRY | ||
update t1 set a=1 where id=2; | ||
SET DEBUG_SYNC = 'now SIGNAL s2'; | ||
disconnect con1; | ||
|
||
--echo /* connection default */ | ||
connection default; | ||
--echo /* reap */ alter table t1 add b int, ALGORITHM=inplace; | ||
--error ER_DUP_ENTRY | ||
--reap | ||
SET DEBUG_SYNC = 'RESET'; | ||
|
||
drop table t1; | ||
|
||
# Wait till all disconnects are completed | ||
--source include/wait_until_count_sessions.inc |
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,76 @@ | ||
--source include/have_innodb.inc | ||
|
||
# Save the initial number of concurrent sessions. | ||
--source include/count_sessions.inc | ||
|
||
CREATE TABLE t (c1 INT PRIMARY KEY, c2 INT NOT NULL, c3 INT) ENGINE=InnoDB; | ||
INSERT INTO t VALUES (1,2,3),(4,5,6),(7,8,9); | ||
|
||
--enable_info | ||
# This one will be a no-op. | ||
# MySQL should perhaps issue an error, because it refuses to modify | ||
# the PRIMARY KEY column c1 from NOT NULL to NULL. | ||
ALTER TABLE t CHANGE c1 c1 INT NULL FIRST, ALGORITHM=INPLACE; | ||
|
||
# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on. | ||
--disable_info | ||
set @old_sql_mode = @@sql_mode; | ||
set @@sql_mode = 'STRICT_TRANS_TABLES'; | ||
--enable_info | ||
ALTER TABLE t MODIFY c3 INT NOT NULL, ALGORITHM=INPLACE; | ||
--disable_info | ||
set @@sql_mode = @old_sql_mode; | ||
--enable_info | ||
|
||
# Request some conflicting changes for a single column. | ||
--error ER_BAD_FIELD_ERROR | ||
ALTER TABLE t CHANGE c2 c2 INT, CHANGE c2 c2 INT NOT NULL; | ||
--error ER_BAD_FIELD_ERROR | ||
ALTER TABLE t MODIFY c2 INT, MODIFY c2 INT NOT NULL; | ||
--error ER_BAD_FIELD_ERROR | ||
ALTER TABLE t MODIFY c2 INT UNSIGNED, MODIFY c2 INT; | ||
--error ER_BAD_FIELD_ERROR | ||
ALTER TABLE t MODIFY c2 CHAR(1) NOT NULL, MODIFY c2 INT NOT NULL; | ||
|
||
# No-ops. | ||
ALTER TABLE t CHANGE c2 c2 INT NOT NULL; | ||
ALTER TABLE t MODIFY c2 INT NOT NULL; | ||
--disable_info | ||
|
||
connect (con1,localhost,root,,); | ||
connection con1; | ||
|
||
SET SQL_MODE='STRICT_ALL_TABLES'; | ||
|
||
--error ER_BAD_NULL_ERROR | ||
UPDATE t SET c2=NULL; | ||
|
||
SELECT * FROM t; | ||
|
||
connection default; | ||
|
||
# This should change the column to NULL. | ||
ALTER TABLE t MODIFY c2 INT, ALGORITHM=INPLACE; | ||
|
||
connection con1; | ||
BEGIN; | ||
UPDATE t SET c2=NULL; | ||
SELECT * FROM t; | ||
ROLLBACK; | ||
SELECT * FROM t; | ||
|
||
disconnect con1; | ||
connection default; | ||
|
||
# This should be no-op. | ||
ALTER TABLE t MODIFY c2 INT NULL, ALGORITHM=INPLACE; | ||
|
||
--replace_column 1 # 5 # | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES | ||
WHERE NAME='test/t'; | ||
|
||
DROP TABLE t; | ||
|
||
# Check that all connections opened by test cases in this file are really | ||
# gone so execution of other tests won't be affected by their presence. | ||
--source include/wait_until_count_sessions.inc |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--loose-innodb-buffer-pool-stats | ||
--loose-innodb-buffer-page | ||
--loose-innodb-buffer-page-lru | ||
--innodb-file-per-table | ||
--innodb-defragment=1 |
Oops, something went wrong.