mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Adjust the imported MySQL 5.6 tests for MariaDB
FIXME: MDEV-13668 InnoDB unnecessarily rebuilds table FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons like the rest of the server FIXME: MDEV-13640 / Properly fix MDEV-9469 'Incorrect key file' on ALTER TABLE FIXME: investigate result difference in innodb.innodb-alter-autoinc and ensure that MariaDB does the right thing with auto_increment_increment and auto_increment_offset, for both ALGORITHM=INPLACE and ALGORITHM=COPY (Oracle MySQL behaviour differs between those two).
This commit is contained in:
@ -13,7 +13,7 @@ INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
|
||||
#
|
||||
t1.ibd
|
||||
ALTER TABLE t1 ENGINE = InnoDB;
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 - Tablespace already exists)
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
|
||||
#
|
||||
# Move the file to InnoDB as t2
|
||||
#
|
||||
@ -31,7 +31,7 @@ a b
|
||||
2 two
|
||||
3 three
|
||||
ALTER TABLE t2 RENAME TO t1;
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 - Tablespace already exists)
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
|
||||
#
|
||||
# Create another t1, but in the system tablespace.
|
||||
#
|
||||
@ -61,7 +61,7 @@ SET GLOBAL innodb_file_per_table=ON;
|
||||
ALTER TABLE t1 ADD COLUMN e1 INT, ALGORITHM=INPLACE;
|
||||
ERROR HY000: Tablespace for table 'test/t1' exists. Please DISCARD the tablespace before IMPORT.
|
||||
ALTER TABLE t1 ADD COLUMN e2 INT, ALGORITHM=COPY;
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 - Tablespace already exists)
|
||||
ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
|
||||
#
|
||||
# Delete the blocking file called MYSQLD_DATADIR/test/t1.ibd
|
||||
# Move t1 to file-per-table using ALGORITHM=INPLACE with no blocking t1.ibd.
|
||||
|
@ -148,7 +148,7 @@ t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 SET a=123;
|
||||
INSERT INTO t1 VALUES(-123,-45);
|
||||
ALTER TABLE t1 AUTO_INCREMENT = 75;
|
||||
@ -161,8 +161,8 @@ a id
|
||||
123 55
|
||||
347 60
|
||||
33101 65
|
||||
123 70
|
||||
123 75
|
||||
123 80
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@ -170,5 +170,5 @@ t1 CREATE TABLE `t1` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`,`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
|
@ -540,6 +540,9 @@ ERROR 42000: Key column 'c2' doesn't exist in table
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
ERROR 42000: Key column 'c2' doesn't exist in table
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
Table Create Table
|
||||
t1n CREATE TABLE `t1n` (
|
||||
@ -556,6 +559,9 @@ ALTER TABLE t1n DROP INDEX c4;
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
Table Create Table
|
||||
t1n CREATE TABLE `t1n` (
|
||||
@ -634,11 +640,10 @@ CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE t1o DROP INDEX ct, DROP INDEX FTS_DOC_ID_INDEX,
|
||||
CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
|
||||
call mtr.add_suppression("Error: no matching column for .FTS_DOC_ID. in index .ct.--temporary-- of table .test...t1o");
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY.
|
||||
ERROR HY000: Incorrect key file for table 't1o'; try to repair it
|
||||
DROP TABLE sys_indexes;
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
@ -646,16 +651,9 @@ SELECT i.NAME,i.POS,i.MTYPE,i.PRTYPE,i.LEN
|
||||
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS i
|
||||
INNER JOIN sys_tables st ON i.TABLE_ID=st.TABLE_ID;
|
||||
NAME POS MTYPE PRTYPE LEN
|
||||
FTS_DOC_ID 0 6 1800 8
|
||||
c2 1 6 1027 4
|
||||
ct 2 5 524540 10
|
||||
cu 3 5 524540 10
|
||||
SELECT si.NAME,i.POS,i.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS i
|
||||
INNER JOIN sys_indexes si ON i.INDEX_ID=si.INDEX_ID;
|
||||
NAME POS NAME
|
||||
PRIMARY 0 FTS_DOC_ID
|
||||
FTS_DOC_ID_INDEX 0 FTS_DOC_ID
|
||||
ct 0 ct
|
||||
SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS i
|
||||
INNER JOIN sys_foreign sf ON i.ID = sf.ID;
|
||||
ID FOR_COL_NAME REF_COL_NAME POS
|
||||
@ -725,21 +723,20 @@ Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c2` int(11) NOT NULL,
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`C1`)
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c5` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`c5`)
|
||||
`C1` int(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`C1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`c2` int(11) NOT NULL,
|
||||
KEY `c2` (`c2`),
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c5`)
|
||||
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`c2`) REFERENCES `t1` (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t2, t1;
|
||||
#
|
||||
|
@ -9,10 +9,11 @@ t1 CREATE TABLE `t1` (
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
SET SESSION DEBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Too many active concurrent transactions
|
||||
SET SESSION DEBUG=DEFAULT;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@ -24,15 +25,15 @@ DROP TABLE t1;
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
|
||||
SET DEBUG='+d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG='-d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
|
||||
SET DEBUG='+d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG='-d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
set global innodb_file_per_table=1;
|
||||
set global innodb_file_format=Antelope;
|
||||
@ -61,8 +62,8 @@ insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
2880
|
||||
SET DEBUG = '+d,innobase_tmpfile_creation_failure';
|
||||
SET DEBUG_DBUG = '+d,innobase_tmpfile_creation_failure';
|
||||
alter table t1 force, algorithm=inplace;
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET DEBUG = '-d,innobase_tmpfile_creation_failure';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
drop table t1, t480;
|
||||
|
@ -90,11 +90,12 @@ a1 a2
|
||||
2 3
|
||||
10 20
|
||||
SET foreign_key_checks = 0;
|
||||
SET DEBUG = '+d,innodb_test_open_ref_fail';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_test_open_ref_fail';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_4 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_open_ref_fail';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
@ -125,9 +126,6 @@ SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/slave_master_info
|
||||
mysql/slave_relay_log_info
|
||||
mysql/slave_worker_info
|
||||
test/child
|
||||
test/parent
|
||||
INSERT INTO child VALUES(5,4);
|
||||
@ -139,12 +137,12 @@ CREATE TABLE `#parent` (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON `#parent`(a, b);
|
||||
CREATE TABLE `#child` (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON `#child`(a1, a2);
|
||||
SET DEBUG = '+d,innodb_test_no_foreign_idx';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx';
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child'
|
||||
SET DEBUG = '-d,innodb_test_no_foreign_idx';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1821 Failed to add the foreign key constaint. Missing index for constraint 'fk_40' in the foreign table '#child'
|
||||
@ -166,21 +164,21 @@ test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
test/fk_4 a1 a 0
|
||||
test/fk_4 a2 b 1
|
||||
SET DEBUG = '+d,innodb_test_no_reference_idx';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent'
|
||||
SET DEBUG = '-d,innodb_test_no_reference_idx';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1822 Failed to add the foreign key constaint. Missing index for constraint 'fk_42' in the referenced table 'parent'
|
||||
SET DEBUG = '+d,innodb_test_wrong_fk_option';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint on table 'child'. Incorrect options in FOREIGN KEY constraint 'test/fk_42'
|
||||
SET DEBUG = '-d,innodb_test_wrong_fk_option';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
test/fk_1 test/child test/parent 1 6
|
||||
@ -199,12 +197,12 @@ test/fk_3 a1 a 0
|
||||
test/fk_3 a2 b 1
|
||||
test/fk_4 a1 a 0
|
||||
test/fk_4 a2 b 1
|
||||
SET DEBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_43 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint 'test/fk_43' to system tables
|
||||
SET DEBUG = '-d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SHOW ERRORS;
|
||||
Level Code Message
|
||||
Error 1823 Failed to add the foreign key constraint 'test/fk_43' to system tables
|
||||
@ -295,13 +293,13 @@ INSERT INTO parent VALUES(10,20),(20,30);
|
||||
CREATE TABLE child (a1 INT NOT NULL, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON child(a2);
|
||||
SET foreign_key_checks = 0;
|
||||
SET DEBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
ERROR HY000: Failed to add the foreign key constraint 'test/fk_1' to system tables
|
||||
SET DEBUG = '-d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
ID FOR_NAME REF_NAME N_COLS TYPE
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
@ -318,9 +316,6 @@ SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/slave_master_info
|
||||
mysql/slave_relay_log_info
|
||||
mysql/slave_worker_info
|
||||
test/child
|
||||
test/parent
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
@ -345,9 +340,6 @@ SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/slave_master_info
|
||||
mysql/slave_relay_log_info
|
||||
mysql/slave_worker_info
|
||||
test/child
|
||||
test/parent
|
||||
SHOW CREATE TABLE child;
|
||||
@ -383,9 +375,6 @@ SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/slave_master_info
|
||||
mysql/slave_relay_log_info
|
||||
mysql/slave_worker_info
|
||||
test/child
|
||||
test/parent
|
||||
SHOW CREATE TABLE child;
|
||||
@ -421,9 +410,6 @@ SYS_FOREIGN_COLS
|
||||
SYS_TABLESPACES
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/slave_master_info
|
||||
mysql/slave_relay_log_info
|
||||
mysql/slave_worker_info
|
||||
test/child
|
||||
test/parent
|
||||
SHOW CREATE TABLE child;
|
||||
|
@ -26,14 +26,15 @@ ddl_background_drop_indexes 0
|
||||
ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_prepare_inplace_alter';
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_inplace_alter';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
DROP INDEX c2 ON t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
@ -121,9 +122,6 @@ database_name table_name index_name last_update stat_name stat_value sample_size
|
||||
test t1 PRIMARY LAST_UPDATE n_diff_pfx01 5 1 c1
|
||||
test t1 PRIMARY LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
||||
test t1 PRIMARY LAST_UPDATE size 1 NULL Number of pages in the index
|
||||
test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE n_diff_pfx01 3 1 DB_ROW_ID
|
||||
test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE n_leaf_pages 1 NULL Number of leaf pages in the index
|
||||
test t1_c2_stats GEN_CLUST_INDEX LAST_UPDATE size 1 NULL Number of pages in the index
|
||||
KILL QUERY @id;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2d_created WAIT_FOR kill_done';
|
||||
@ -184,11 +182,10 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 STATS_PERSISTENT=1
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done';
|
||||
SET lock_wait_timeout = 10;
|
||||
ALTER TABLE t1 CHANGE c2 c22 INT, DROP INDEX c2d, ADD INDEX c2e(c22),
|
||||
ALTER TABLE t1 DROP INDEX c2d, ADD INDEX c2e(c2),
|
||||
ALGORITHM = INPLACE;
|
||||
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2e_created';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
@ -249,7 +246,7 @@ ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
|
||||
ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
|
||||
ALTER TABLE t1 ADD INDEX c2f(c2);
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
@ -273,7 +270,8 @@ ddl_online_create_index 1
|
||||
ddl_pending_alter_table 1
|
||||
SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
||||
Warnings:
|
||||
Note 1831 Duplicate index 'c2f' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
|
||||
Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release.
|
||||
ALTER TABLE t1 CHANGE c2 c22f INT;
|
||||
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
|
||||
name count
|
||||
ddl_background_drop_indexes 0
|
||||
@ -339,10 +337,8 @@ ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE;
|
||||
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = COPY;
|
||||
ERROR 42000: Duplicate key name 'c2h'
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG = '';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL DEBUG = '';
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
||||
|
@ -31,14 +31,21 @@ ddl_background_drop_tables 0
|
||||
ddl_online_create_index 0
|
||||
ddl_pending_alter_table 0
|
||||
# session con1
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_prepare_inplace_alter';
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_inplace_alter';
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
# session default
|
||||
SHOW CREATE TABLE t1;
|
||||
@ -68,7 +75,7 @@ LOCK = SHARED, ALGORITHM = INPLACE;
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2),
|
||||
LOCK = EXCLUSIVE, ALGORITHM = INPLACE;
|
||||
Warnings:
|
||||
Note 1831 Duplicate index 'c2_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
|
||||
Note 1831 Duplicate index `c2_2`. This is deprecated and will be disallowed in a future release.
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@ -359,10 +366,8 @@ t1 CREATE TABLE `t1` (
|
||||
PRIMARY KEY (`c1`,`c22f`,`c4`(5))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG = '';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL DEBUG = '';
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
SET GLOBAL innodb_monitor_disable = default;
|
||||
|
@ -1010,6 +1010,9 @@ ERROR 42000: Key column 'c2' doesn't exist in table
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
ERROR 42000: Key column 'c2' doesn't exist in table
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE;
|
||||
### files in MYSQL_DATA_DIR/test
|
||||
FTS_AUX_INDEX_1.ibd
|
||||
FTS_AUX_INDEX_2.ibd
|
||||
@ -1110,6 +1113,9 @@ tt.ibd
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
ERROR 42S21: Duplicate column name 'c1'
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE;
|
||||
### files in MYSQL_DATA_DIR/test
|
||||
FTS_AUX_INDEX_1.ibd
|
||||
FTS_AUX_INDEX_2.ibd
|
||||
@ -1195,9 +1201,13 @@ tt.isl
|
||||
t1c.ibd
|
||||
t1p.ibd
|
||||
tt.ibd
|
||||
call mtr.add_suppression("Error: no matching column for .FTS_DOC_ID. in index .ct.--temporary-- of table .test...t1o");
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
ERROR HY000: Incorrect key file for table 't1o'; try to repair it
|
||||
ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
|
||||
### files in MYSQL_DATA_DIR/test
|
||||
FTS_AUX_INDEX_1.ibd
|
||||
FTS_AUX_INDEX_2.ibd
|
||||
@ -1239,9 +1249,6 @@ tt.isl
|
||||
t1c.ibd
|
||||
t1p.ibd
|
||||
tt.ibd
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
LOCK=NONE;
|
||||
ERROR 0A000: LOCK=NONE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try LOCK=SHARED.
|
||||
SELECT sc.pos FROM information_schema.innodb_sys_columns sc
|
||||
INNER JOIN information_schema.innodb_sys_tables st
|
||||
ON sc.TABLE_ID=st.TABLE_ID
|
||||
@ -1345,6 +1352,9 @@ tt.isl
|
||||
tt.ibd
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
ERROR HY000: Incorrect key file for table 't1o'; try to repair it
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
|
||||
### files in MYSQL_DATA_DIR/test
|
||||
FTS_AUX_INDEX_1.ibd
|
||||
FTS_AUX_INDEX_2.ibd
|
||||
|
1
mysql-test/suite/innodb/t/index_tree_operation.opt
Normal file
1
mysql-test/suite/innodb/t/index_tree_operation.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb-sys-tablespaces
|
3
mysql-test/suite/innodb/t/innodb-alter.opt
Normal file
3
mysql-test/suite/innodb/t/innodb-alter.opt
Normal file
@ -0,0 +1,3 @@
|
||||
--loose-innodb-sys-indexes
|
||||
--loose-innodb-sys-columns
|
||||
--loose-innodb-sys-fields
|
@ -298,12 +298,21 @@ SHOW CREATE TABLE t1n;
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
# FIXME: MDEV-13668 InnoDB unnecessarily rebuilds table
|
||||
# when renaming a column and adding index
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE;
|
||||
SHOW CREATE TABLE t1n;
|
||||
ALTER TABLE t1n DROP INDEX c4;
|
||||
--error ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
# FIXME: MDEV-13668
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE;
|
||||
|
||||
SHOW CREATE TABLE t1n;
|
||||
DROP TABLE t1n;
|
||||
@ -361,12 +370,16 @@ CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL;
|
||||
|
||||
ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
|
||||
|
||||
# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE
|
||||
call mtr.add_suppression("Error: no matching column for .FTS_DOC_ID. in index .ct.--temporary-- of table .test...t1o");
|
||||
--error ER_NOT_KEYFILE
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
# FIXME: MDEV-9469 (enable this)
|
||||
#--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
#ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
#ALGORITHM=INPLACE;
|
||||
#end of MDEV-9469 FIXME
|
||||
|
||||
DROP TABLE sys_indexes;
|
||||
CREATE TABLE sys_indexes SELECT i.* FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES i
|
||||
@ -421,7 +434,9 @@ SHOW CREATE TABLE t2;
|
||||
ALTER TABLE t1 CHANGE COLUMN c1 C1 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
|
||||
# FIXME: MDEV-13671 InnoDB should use case-insensitive column name comparisons
|
||||
# like the rest of the server
|
||||
#ALTER TABLE t1 CHANGE COLUMN C1 c5 INT;
|
||||
SHOW CREATE TABLE t1;
|
||||
SHOW CREATE TABLE t2;
|
||||
DROP TABLE t2, t1;
|
||||
|
@ -15,10 +15,11 @@ CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1)) Engine=InnoDB;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
|
||||
|
||||
SET SESSION DEBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG='+d,ib_build_indexes_too_many_concurrent_trxs, ib_rename_indexes_too_many_concurrent_trxs, ib_drop_index_too_many_concurrent_trxs';
|
||||
--error ER_TOO_MANY_CONCURRENT_TRXS
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET SESSION DEBUG=DEFAULT;
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
@ -29,20 +30,20 @@ DROP TABLE t1;
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT NOT NULL, INDEX(c2))
|
||||
ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, 0), (4, 0), (0, 0);
|
||||
SET DEBUG='+d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
# Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
|
||||
# No crash here, because n_uniq for c2 includes the clustered index fields
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG='-d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
|
||||
CREATE TABLE bug13861218 (c1 INT NOT NULL, c2 INT UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO bug13861218 VALUES (8, NULL), (4, NULL), (0, NULL);
|
||||
SET DEBUG='+d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = '+d,ib_row_merge_buf_add_two';
|
||||
# Force creation of a PRIMARY KEY on c1 to see what happens on the index(c2).
|
||||
# assertion failure: ut_ad(cmp_dtuple_rec(dtuple, rec, rec_offsets) > 0)
|
||||
CREATE UNIQUE INDEX ui ON bug13861218(c1);
|
||||
SET DEBUG='-d,ib_row_merge_buf_add_two';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
DROP TABLE bug13861218;
|
||||
|
||||
eval set global innodb_file_per_table=$per_table;
|
||||
@ -76,8 +77,8 @@ insert into t1 select NULL,'aaaaaaa','bbbbbbb','ccccccc' from t480;
|
||||
insert into t1 select NULL,'aaaaaaaa','bbbbbbbb','cccccccc' from t480;
|
||||
select count(*) from t1;
|
||||
|
||||
SET DEBUG = '+d,innobase_tmpfile_creation_failure';
|
||||
SET DEBUG_DBUG = '+d,innobase_tmpfile_creation_failure';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
alter table t1 force, algorithm=inplace;
|
||||
SET DEBUG = '-d,innobase_tmpfile_creation_failure';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
drop table t1, t480;
|
||||
|
4
mysql-test/suite/innodb/t/innodb-index-online-fk.opt
Normal file
4
mysql-test/suite/innodb/t/innodb-index-online-fk.opt
Normal file
@ -0,0 +1,4 @@
|
||||
--loose-innodb-sys-tables
|
||||
--loose-innodb-sys-columns
|
||||
--loose-innodb-sys-foreign
|
||||
--loose-innodb-sys-foreign-cols
|
@ -92,11 +92,12 @@ SET foreign_key_checks = 0;
|
||||
# This is to test the scenario we cannot open the referenced table.
|
||||
# Since foreign_key_checks is set to 0, the foreign key should still
|
||||
# be added.
|
||||
SET DEBUG = '+d,innodb_test_open_ref_fail';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_test_open_ref_fail';
|
||||
ALTER TABLE child ADD CONSTRAINT fk_4 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_open_ref_fail';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
@ -127,12 +128,12 @@ CREATE TABLE `#child` (a1 INT PRIMARY KEY, a2 INT) ENGINE = InnoDB;
|
||||
CREATE INDEX tb ON `#child`(a1, a2);
|
||||
|
||||
# This is to test the scenario no foreign index, alter table should fail
|
||||
SET DEBUG = '+d,innodb_test_no_foreign_idx';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_foreign_idx';
|
||||
--error ER_FK_NO_INDEX_CHILD,
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_40 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_no_foreign_idx';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
@ -142,23 +143,23 @@ SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# This is to test the scenario no index on referenced table,
|
||||
# alter table should fail
|
||||
SET DEBUG = '+d,innodb_test_no_reference_idx';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_no_reference_idx';
|
||||
--error ER_FK_NO_INDEX_PARENT,
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_no_reference_idx';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
# This is to test the scenario no index on referenced table,
|
||||
# alter table should fail
|
||||
SET DEBUG = '+d,innodb_test_wrong_fk_option';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_wrong_fk_option';
|
||||
--error ER_FK_INCORRECT_OPTION
|
||||
ALTER TABLE child ADD CONSTRAINT fk_42 FOREIGN KEY (a1, a2)
|
||||
REFERENCES parent(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_wrong_fk_option';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SELECT * FROM information_schema.INNODB_SYS_FOREIGN;
|
||||
|
||||
@ -166,12 +167,12 @@ SELECT * FROM information_schema.INNODB_SYS_FOREIGN_COLS;
|
||||
|
||||
# This is to test the scenario cannot add fk to the system table,
|
||||
# alter table should fail
|
||||
SET DEBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
--error ER_FK_FAIL_ADD_SYSTEM
|
||||
ALTER TABLE `#child` ADD CONSTRAINT fk_43 FOREIGN KEY (a1, a2)
|
||||
REFERENCES `#parent`(a, b) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SHOW ERRORS;
|
||||
|
||||
@ -275,13 +276,13 @@ SET foreign_key_checks = 0;
|
||||
|
||||
# Let's rebuild the table and add the FK, make the add FK failed.
|
||||
|
||||
SET DEBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = '+d,innodb_test_cannot_add_fk_system';
|
||||
--error ER_FK_FAIL_ADD_SYSTEM
|
||||
ALTER TABLE child ADD PRIMARY KEY idx (a3), CHANGE a1 a3 INT,
|
||||
ADD CONSTRAINT fk_1 FOREIGN KEY (a2) REFERENCES parent(b)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
ALGORITHM = INPLACE;
|
||||
SET DEBUG = '-d,innodb_test_cannot_add_fk_system';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
|
||||
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
|
||||
|
@ -1 +0,0 @@
|
||||
--innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=64k --innodb-buffer-pool-size=5M --innodb-log-buffer-size=256k
|
6
mysql-test/suite/innodb/t/innodb-index-online.opt
Normal file
6
mysql-test/suite/innodb/t/innodb-index-online.opt
Normal file
@ -0,0 +1,6 @@
|
||||
--innodb-sort-buffer-size=64k
|
||||
--innodb-online-alter-log-max-size=64k
|
||||
--innodb-buffer-pool-size=5M
|
||||
--innodb-log-buffer-size=256k
|
||||
--innodb-sys-indexes
|
||||
--innodb-sys-fields
|
@ -1,4 +1,4 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/innodb_page_size_small.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
let $innodb_metrics_select=
|
||||
@ -42,14 +42,15 @@ reap;
|
||||
eval $innodb_metrics_select;
|
||||
|
||||
connection con1;
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_prepare_inplace_alter';
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_inplace_alter';
|
||||
SET DEBUG_DBUG = @saved_debug_dbug;
|
||||
CREATE UNIQUE INDEX c2 ON t1(c2);
|
||||
DROP INDEX c2 ON t1;
|
||||
|
||||
@ -206,7 +207,9 @@ SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2e_created WAIT_FOR dml2_done';
|
||||
# Ensure that the ALTER TABLE will be executed even with some concurrent DML.
|
||||
SET lock_wait_timeout = 10;
|
||||
--send
|
||||
ALTER TABLE t1 CHANGE c2 c22 INT, DROP INDEX c2d, ADD INDEX c2e(c22),
|
||||
# FIXME: MDEV-13668
|
||||
#ALTER TABLE t1 CHANGE c2 c22 INT, DROP INDEX c2d, ADD INDEX c2e(c22),
|
||||
ALTER TABLE t1 DROP INDEX c2d, ADD INDEX c2e(c2),
|
||||
ALGORITHM = INPLACE;
|
||||
|
||||
# Generate some log (delete-mark, delete-unmark, insert etc.)
|
||||
@ -215,7 +218,7 @@ ALGORITHM = INPLACE;
|
||||
connection default;
|
||||
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
|
||||
INSERT INTO t1 SELECT 160 + c1, c2, c3 FROM t1;
|
||||
UPDATE t1 SET c2 = c2 + 1;
|
||||
#UPDATE t1 SET c2 = c2 + 1;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2e_created';
|
||||
# At this point, the clustered index scan must have completed,
|
||||
# but the modification log keeps accumulating due to the DEBUG_SYNC.
|
||||
@ -271,7 +274,9 @@ connection con1;
|
||||
# Accumulate and apply some modification log.
|
||||
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
|
||||
--send
|
||||
ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
|
||||
# FIXME: MDEV-13668
|
||||
#ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
|
||||
ALTER TABLE t1 ADD INDEX c2f(c2);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
|
||||
@ -291,6 +296,9 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done';
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
# FIXME: MDEV-13668
|
||||
ALTER TABLE t1 CHANGE c2 c22f INT;
|
||||
|
||||
eval $innodb_metrics_select;
|
||||
SELECT COUNT(c22f) FROM t1;
|
||||
CHECK TABLE t1;
|
||||
@ -386,7 +394,6 @@ ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = INPLACE;
|
||||
ALTER TABLE t1 ADD INDEX c2h(c22f), ALGORITHM = COPY;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG = '';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
|
||||
DROP TABLE t1;
|
||||
@ -395,7 +402,6 @@ DROP TABLE t1;
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
SET GLOBAL DEBUG = '';
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
--disable_warnings
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
|
@ -1,4 +1,5 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/innodb_page_size.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
let $innodb_metrics_select=
|
||||
@ -48,14 +49,15 @@ eval $innodb_metrics_select;
|
||||
|
||||
--echo # session con1
|
||||
connection con1;
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,innodb_OOM_prepare_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_prepare_inplace_alter';
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
SET SESSION DEBUG = '+d,innodb_OOM_inplace_alter';
|
||||
--error ER_OUT_OF_RESOURCES
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
SET SESSION DEBUG = '-d,innodb_OOM_inplace_alter';
|
||||
SET SESSION DEBUG = @saved_debug_dbug;
|
||||
ALTER TABLE t1 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
|
||||
|
||||
--echo # session default
|
||||
@ -363,7 +365,6 @@ disconnect con1;
|
||||
connection default;
|
||||
SHOW CREATE TABLE t1;
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET DEBUG = '';
|
||||
SET GLOBAL innodb_monitor_disable = module_ddl;
|
||||
DROP TABLE t1;
|
||||
|
||||
@ -371,7 +372,6 @@ DROP TABLE t1;
|
||||
# gone so execution of other tests won't be affected by their presence.
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
SET GLOBAL DEBUG = '';
|
||||
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
|
||||
--disable_warnings
|
||||
SET GLOBAL innodb_monitor_enable = default;
|
||||
|
3
mysql-test/suite/innodb/t/innodb-wl5980-alter.opt
Normal file
3
mysql-test/suite/innodb/t/innodb-wl5980-alter.opt
Normal file
@ -0,0 +1,3 @@
|
||||
--loose-innodb-sys-indexes
|
||||
--loose-innodb-sys-columns
|
||||
--loose-innodb-sys-fields
|
@ -447,7 +447,12 @@ ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
--error ER_KEY_COLUMN_DOES_NOT_EXITS
|
||||
ALTER TABLE t1n ADD INDEX(c2), CHANGE c2 c4 INT, ALGORITHM=COPY;
|
||||
|
||||
# FIXME: MDEV-13668 InnoDB unnecessarily rebuilds table
|
||||
# when renaming a column and adding index
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1n ADD INDEX(c4), CHANGE c2 c4 INT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c2 c4 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c4), LOCK=NONE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
@ -469,7 +474,11 @@ ALTER TABLE t1n DROP INDEX c4;
|
||||
|
||||
--error ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1n CHANGE c4 c1 INT, ADD INDEX(c1), ALGORITHM=INPLACE;
|
||||
# FIXME: MDEV-13668
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, ADD INDEX(c11), ALGORITHM=INPLACE;
|
||||
ALTER TABLE t1n CHANGE c4 c11 INT, LOCK=NONE;
|
||||
ALTER TABLE t1n ADD INDEX(c11), LOCK=NONE;
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
@ -491,10 +500,17 @@ ALTER TABLE t1o MODIFY c1 BIGINT UNSIGNED NOT NULL;
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE
|
||||
call mtr.add_suppression("Error: no matching column for .FTS_DOC_ID. in index .ct.--temporary-- of table .test...t1o");
|
||||
--error ER_NOT_KEYFILE
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct),
|
||||
CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ALGORITHM=INPLACE;
|
||||
|
||||
ALTER TABLE t1o CHANGE c1 FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
|
||||
# end of MDEV-9469 FIXME
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
@ -503,9 +519,11 @@ ALGORITHM=INPLACE;
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# This would create a hidden FTS_DOC_ID column, which cannot be done online.
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
LOCK=NONE;
|
||||
# FIXME: MDEV-9469 (enable this)
|
||||
#--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
#ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
#LOCK=NONE;
|
||||
#end of MDEV-9469 FIXME
|
||||
|
||||
# This should not show duplicates.
|
||||
SELECT sc.pos FROM information_schema.innodb_sys_columns sc
|
||||
@ -516,6 +534,7 @@ WHERE st.NAME='test/t1o' AND sc.NAME='FTS_DOC_ID';
|
||||
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
|
||||
SHOW CREATE TABLE t1o;
|
||||
|
||||
# FIXME: MDEV-13668
|
||||
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
|
||||
DROP INDEX ct, LOCK=NONE;
|
||||
|
||||
@ -553,9 +572,15 @@ ALTER TABLE t1o ADD UNIQUE INDEX FTS_DOC_ID_INDEX(foo_id);
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_TMP_DIR/alt_dir/test
|
||||
|
||||
# FIXME: MDEV-9469 'Incorrect key file' on ALTER TABLE
|
||||
--error ER_NOT_KEYFILE
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL,
|
||||
ADD FULLTEXT INDEX(ct);
|
||||
|
||||
ALTER TABLE t1o CHANGE foo_id FTS_DOC_ID BIGINT UNSIGNED NOT NULL, LOCK=NONE;
|
||||
ALTER TABLE t1o ADD FULLTEXT INDEX(ct), ALGORITHM=INPLACE;
|
||||
#end of MDEV-9469 FIXME
|
||||
|
||||
--echo ### files in MYSQL_DATA_DIR/test
|
||||
--replace_regex $regexp
|
||||
--list_files $MYSQL_DATA_DIR/test
|
||||
|
Reference in New Issue
Block a user