diff options
Diffstat (limited to 'mysql-test/suite/innodb/t')
-rw-r--r-- | mysql-test/suite/innodb/t/create_isl_with_direct.test | 7 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test | 81 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/import_tablespace_race.test | 55 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb-table-online.test | 21 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb-wl5522-1.test | 31 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/restart.test | 62 |
6 files changed, 247 insertions, 10 deletions
diff --git a/mysql-test/suite/innodb/t/create_isl_with_direct.test b/mysql-test/suite/innodb/t/create_isl_with_direct.test index 2092d03b72f..45d7fbf4ea5 100644 --- a/mysql-test/suite/innodb/t/create_isl_with_direct.test +++ b/mysql-test/suite/innodb/t/create_isl_with_direct.test @@ -2,13 +2,6 @@ --source include/have_innodb.inc --source include/have_symlink.inc ---disable_query_log -CALL mtr.add_suppression(".*Failed to set O_DIRECT on file.*"); - -# The below mtr suppression to avoid failure in solaris platform. -CALL mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to set DIRECTIO_ON on file.*"); ---enable_query_log - SHOW VARIABLES LIKE 'innodb_flush_method'; let MYSQLD_DATADIR=`SELECT @@datadir`; diff --git a/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test new file mode 100644 index 00000000000..b3adfb3b02d --- /dev/null +++ b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test @@ -0,0 +1,81 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc + +CREATE TABLE t1 ( + pkey int NOT NULL PRIMARY KEY, + c int +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES(1,1); + +CREATE TABLE t2 ( + pkey int NOT NULL PRIMARY KEY, + c int +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO t2 VALUES (2, NULL); + +# The following table is to increase tansaction weight on deadlock resolution +CREATE TABLE t3 (c int) engine = InnoDB; +INSERT INTO t3 VALUES (10), (20), (30), (40), (50); + +--let $i= 2 +--let $delete= 2 +--let $update= 1 +--connect(con1, localhost,root,,) + +while($i) { +--connection default +START TRANSACTION; # trx 1 +# The following update is necessary to increase the transaction weight, which is +# calculated as the number of locks + the number of undo records during deadlock +# report. Victim's transaction should have minimum weight. We need trx 2 to be +# choosen as victim, that's why we need to increase the current transaction +# weight. +UPDATE t3 SET c=c+1000; +SELECT * FROM t1 FOR UPDATE; + +--connection con1 +START TRANSACTION; # trx 2 +# 1) read record from t2, lock it +# 2) check if the read record should be deleted, i.e. read record from t1, +# as the record from t1 is locked by trx 1, the subselect will be suspended. +# see 'while' loop in mysql_delete() or mysql_update() and +# select->skip_record(thd) call for details. +if ($i == $delete) { +--send DELETE FROM t2 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey) +} +if ($i == $update) { +--send UPDATE t2 SET pkey=pkey+10 WHERE c NOT IN (SELECT ref_0.pkey FROM t1 AS ref_0 INNER JOIN t1 AS ref_1 ON ref_0.c = ref_0.pkey) +} + +--connection default +let $wait_condition= + SELECT count(*) = 1 FROM information_schema.processlist + WHERE (state = 'Sending data' OR state = "Updating") + AND (info LIKE 'delete from t2 where%' OR + info LIKE 'UPDATE t2 SET pkey=pkey+10 WHERE%'); +--source include/wait_condition.inc + +# The record from t2 is locked by the previous delete, so trx 2 is waiting for +# trx 1, and trx 1 will be blocked by trx 2 with the following SELECT. So we +# have deadlock here. And trx 2 is chosen as deadlock victim as trx 1 has +# greater weight. +SELECT * FROM t2 FOR UPDATE; +COMMIT; + +--connection con1 +# If the bug is not fixed, there will be assertion failure as +# mysql_delete()/mysql_update() will continue execution despite its subselect +# got deadlock error +--error ER_LOCK_DEADLOCK +--reap +COMMIT; +--dec $i +} + +--disconnect con1 + +--connection default +DROP TABLE t1,t2,t3; +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/suite/innodb/t/import_tablespace_race.test b/mysql-test/suite/innodb/t/import_tablespace_race.test new file mode 100644 index 00000000000..10ffe061ed1 --- /dev/null +++ b/mysql-test/suite/innodb/t/import_tablespace_race.test @@ -0,0 +1,55 @@ +--source include/have_innodb.inc +--source include/have_sequence.inc + +--echo # +--echo # MDEV-29144 ER_TABLE_SCHEMA_MISMATCH or crash on DISCARD/IMPORT +--echo # + +call mtr.add_suppression("InnoDB: Unknown index id"); +CREATE TABLE t (pk int PRIMARY KEY, c varchar(1024)) +ENGINE=InnoDB CHARSET latin1; +INSERT INTO t SELECT seq, 'x' FROM seq_1_to_100; + +--connect (con1,localhost,root,,test) +--delimiter $ +--send + BEGIN NOT ATOMIC + DECLARE a INT DEFAULT 0; + REPEAT + SET a= a+1; + UPDATE t SET c = 'xx' WHERE pk = a; + UNTIL a = 100 + END REPEAT; + END +$ +--delimiter ; + +--connection default +--error 0,ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t NOWAIT ADD INDEX (c); + +--connection con1 +--reap + +--connection default + +--let $datadir= `select @@datadir` + +FLUSH TABLE t FOR EXPORT; +--let $create= query_get_value(SHOW CREATE TABLE t, Create Table, 1) +--copy_file $datadir/test/t.cfg $MYSQL_TMP_DIR/t.cfg +--copy_file $datadir/test/t.ibd $MYSQL_TMP_DIR/t.ibd +UNLOCK TABLES; + +DROP TABLE t; +--disable_query_log +eval $create; +--enable_query_log + +ALTER TABLE t DISCARD TABLESPACE; +--move_file $MYSQL_TMP_DIR/t.cfg $datadir/test/t.cfg +--move_file $MYSQL_TMP_DIR/t.ibd $datadir/test/t.ibd +ALTER TABLE t IMPORT TABLESPACE; + +# Cleanup +DROP TABLE t; diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 170ba5072f5..45b1bc1ec8e 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -420,11 +420,28 @@ SET DEBUG_SYNC = 'now SIGNAL updated'; connection con1; reap; -disconnect con1; connection default; DROP TABLE t1; -SET DEBUG_SYNC = 'RESET'; +--echo # +--echo # MDEV-29977 Memory leak in row_log_table_apply_update +--echo # +CREATE TABLE t1(f1 longtext, f2 int, KEY(f1(1024)), KEY(f2, f1(20))) ENGINE=InnoDB; +INSERT INTO t1 VALUES('a', 1); +connection con1; +set DEBUG_SYNC="innodb_inplace_alter_table_enter SIGNAL con_default WAIT_FOR con1_signal"; +send ALTER TABLE t1 FORCE; +connection default; +SET DEBUG_SYNC="now WAIT_FOR con_default"; +UPDATE t1 SET f1 = NULL; +UPDATE t1 SET f1 = REPEAT('b', 9000); +SET DEBUG_SYNC="now SIGNAL con1_signal"; +connection con1; +reap; +DROP TABLE t1; +connection default; +SET DEBUG_SYNC=RESET; +disconnect con1; # 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. diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-1.test b/mysql-test/suite/innodb/t/innodb-wl5522-1.test index 0d59df11c44..dbd58835ec6 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-1.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-1.test @@ -932,3 +932,34 @@ call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tabl --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd --remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.cfg --remove_file $MYSQLTEST_VARDIR/tmp/t1_fk.ibd + +--echo # +--echo # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +--echo # +--echo # + +CREATE TABLE `t1` (`i` int(11) NOT NULL, PRIMARY KEY (`i`) ) ENGINE=InnoDB; +FLUSH TABLES t1 FOR EXPORT; + +# We use the cfg file of ours. +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF + +UNLOCK TABLES; +ALTER TABLE t1 DISCARD TABLESPACE; + +--move_file $MYSQLTEST_VARDIR/tmp/t1.cfg $MYSQLD_DATADIR/test/t1.cfg +--copy_file std_data/mysql80/t1.ibd $MYSQLD_DATADIR/test/t1.ibd + +call mtr.add_suppression("InnoDB: unsupported MySQL tablespace"); +--error ER_UNSUPPORTED_EXTENSION +ALTER TABLE t1 IMPORT TABLESPACE; + +DROP TABLE t1; +--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index bb3d08a8779..5be076c6198 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -15,6 +15,9 @@ let page_size= `select @@innodb_page_size`; --echo # FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files --echo # of tables with .isl file or DATA DIRECTORY attribute. +call mtr.add_suppression("\\[ERROR\\] InnoDB: MySQL-8\\.0 tablespace in "); +call mtr.add_suppression("\\[ERROR\\] InnoDB: Restart in MySQL for migration/recovery\\."); + --echo # FIXME: This is much more noisy than MariaDB 10.1! call mtr.add_suppression("\\[ERROR\\] InnoDB: Tablespace flags are invalid in datafile: .*test.t[rcd]\\.ibd"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\."); @@ -46,7 +49,7 @@ die unless open OUT, ">", "$ENV{datadir}/test/tc.ibd"; print OUT "bar " x $ENV{page_size}; close OUT or die; die unless open OUT, ">", "$ENV{MYSQL_TMP_DIR}/test/td.ibd"; -print OUT "xyz " x $ENV{page_size}; +print OUT "Xyz " x $ENV{page_size}; close OUT or die; die unless open ISL, "+<", "$ENV{datadir}/test/td.isl"; $_=<ISL>; @@ -109,3 +112,60 @@ EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size --source include/wait_condition.inc SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; + +--echo # +--echo # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message +--echo # + +--let MYSQLD_DATADIR= `SELECT @@datadir` +--let SERVER_ID= `SELECT @@server_id` +--let EXPECT_FILE_NAME= $MYSQLTEST_VARDIR/tmp/mysqld.$SERVER_ID.expect + +--source include/shutdown_mysqld.inc + +--move_file $MYSQLD_DATADIR/ibdata1 $MYSQLD_DATADIR/ibdata1.bak +--copy_file std_data/mysql80/ibdata1_$page_size $MYSQLD_DATADIR/ibdata1 + +perl; +use IO::Handle; +my $size = 9 * 1048576; +if ($ENV{MTR_COMBINATION_32K}) { + $size *= 2; +} +if ($ENV{MTR_COMBINATION_64K}) { + $size *= 4; +} +$size -= $ENV{page_size}; +die unless open(FILE, ">>", "$ENV{MYSQLD_DATADIR}/ibdata1"); +binmode FILE; + +print FILE chr(0) x $size; +close(FILE); +EOF + +--let ibdata_size='9M' +if ($MTR_COMBINATION_32K) +{ +--let ibdata_size='18M' +} +if ($MTR_COMBINATION_64K) +{ +--let ibdata_size='36M' +} + +--error 1 +exec $MYSQLD --no-defaults --skip-networking --innodb_data_file_path=ibdata1:$ibdata_size --innodb-page-size=$page_size --datadir=$MYSQLD_DATADIR --log-error=$MYSQL_TMP_DIR/attempted_start.err; + +let SEARCH_FILE= $MYSQL_TMP_DIR/attempted_start.err; +let SEARCH_PATTERN= InnoDB: MySQL-8\.0 tablespace in \./ibdata1; +source include/search_pattern_in_file.inc; + +--remove_file $MYSQL_TMP_DIR/attempted_start.err +--remove_file $MYSQLD_DATADIR/ibdata1 +--move_file $MYSQLD_DATADIR/ibdata1.bak $MYSQLD_DATADIR/ibdata1 + +--source include/start_mysqld.inc + +--echo # +--echo # End of 10.3 tests +--echo # |