From bef30f2e306dc6107f0ec314bf7bde8939c124e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 26 Sep 2014 12:16:05 +0300 Subject: [PATCH] Fix test failures seen on -- innodb-wl5522-debug-zip (path differences win/unix) -- innodb_defragment_fill_factor (stabilise) -- innodb_force_pk (case difference win/unix) --- .../innodb/r/innodb-wl5522-debug-zip.result | 6 +- .../r/innodb_defragment_fill_factor.result | 40 ++++++++---- .../suite/innodb/r/innodb_force_pk.result | 58 ++++++++--------- .../innodb/t/innodb-wl5522-debug-zip.test | 11 ++-- .../t/innodb_defragment_fill_factor.test | 64 +++++++++++-------- .../suite/innodb/t/innodb_force_pk.test | 44 ++++++------- 6 files changed, 122 insertions(+), 101 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result index a4e44be1c72..0e863f5849e 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug-zip.result @@ -104,7 +104,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure"; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 44 'Tablespace not found' from ./test_wl5522/t1.ibd +ERROR HY000: Got error 44 't1.ibd SET SESSION debug_dbug="-d,ib_import_open_tablespace_failure"; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; @@ -537,7 +537,7 @@ ERROR HY000: Tablespace has been discarded for table 't1' restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,fil_space_create_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 11 'Generic error' from ./test_wl5522/t1.ibd +ERROR HY000: Got error 11 't1.ibd SET SESSION debug_dbug="-d,fil_space_create_failure"; DROP TABLE test_wl5522.t1; unlink: t1.ibd @@ -550,7 +550,7 @@ ERROR HY000: Tablespace has been discarded for table 't1' restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; -ERROR HY000: Got error 39 'Data structure corruption' from ./test_wl5522/t1.ibd +ERROR HY000: Got error 39 't1.ibd SET SESSION debug_dbug="-d,dict_tf_to_fsp_flags_failure"; DROP TABLE test_wl5522.t1; unlink: t1.ibd diff --git a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result index 7c153eaaa93..04e41046a6a 100644 --- a/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result +++ b/mysql-test/suite/innodb/r/innodb_defragment_fill_factor.result @@ -2,32 +2,48 @@ DROP TABLE if exists t1; DROP TABLE if exists t2; Testing tables with large records CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, REPEAT('A', 256)); +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK +select sleep(1); +sleep(1) +0 select count(*) from t1; count(*) -790 +927 select count(*) from t1 force index (second); count(*) -790 +927 # A few more insertions on the page should not cause a page split. insert into t1 values (81, REPEAT('A', 256)); insert into t1 values (83, REPEAT('A', 256)); -# More insertions will cause page splits -insert into t1 values (88, REPEAT('A', 50)); -insert into t1 values (85, REPEAT('A', 256)); -insert into t1 values (84, REPEAT('A', 256)); insert into t1 values (87, REPEAT('A', 256)); -insert into t1 values (89, REPEAT('A', 256)); insert into t1 values (82, REPEAT('A', 256)); insert into t1 values (86, REPEAT('A', 256)); +# More insertions will cause page splits +insert into t1 values (88, REPEAT('A', 256)); +insert into t1 values (85, REPEAT('A', 256)); +insert into t1 values (84, REPEAT('A', 256)); DROP TABLE t1; Testing table with small records CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARchar(16), KEY SECOND(a,b)) ENGINE=INNODB; optimize table t2; Table Op Msg_type Msg_text test.t2 optimize status OK +select sleep(1); +sleep(1) +0 select count(*) from t2 force index(second); count(*) 3701 @@ -49,16 +65,12 @@ insert into t2 values(1197, REPEAT('A', 16)); insert into t2 values(1188, REPEAT('A', 16)); insert into t2 values(1198, REPEAT('A', 16)); insert into t2 values(1189, REPEAT('A', 16)); +insert into t2 values(1199, REPEAT('A', 16)); +insert into t2 values(1190, REPEAT('A', 16)); +insert into t2 values(1180, REPEAT('A', 16)); More insertions will cause page split. insert into t2 values(1280, REPEAT('A', 16)); insert into t2 values(1290, REPEAT('A', 16)); insert into t2 values(1281, REPEAT('A', 16)); insert into t2 values(1291, REPEAT('A', 16)); -insert into t2 values(1199, REPEAT('A', 16)); -insert into t2 values(1190, REPEAT('A', 16)); -insert into t2 values(1180, REPEAT('A', 16)); -insert into t2 values(1295, REPEAT('A', 16)); -insert into t2 values(1294, REPEAT('A', 16)); -insert into t2 values(1292, REPEAT('A', 16)); -insert into t2 values(1293, REPEAT('A', 16)); DROP TABLE t2; diff --git a/mysql-test/suite/innodb/r/innodb_force_pk.result b/mysql-test/suite/innodb/r/innodb_force_pk.result index d8abfda35e1..ea8fd784320 100644 --- a/mysql-test/suite/innodb/r/innodb_force_pk.result +++ b/mysql-test/suite/innodb/r/innodb_force_pk.result @@ -1,53 +1,53 @@ -CREATE TABLE T1(A INTEGER) ENGINE=INNODB; +create table t1(a integer) engine=innodb; ERROR 42000: This table type requires a primary key -SHOW WARNINGS; +show warnings; Level Code Message Error 1173 This table type requires a primary key -CREATE TABLE T1(A INTEGER UNIQUE KEY) ENGINE=INNODB; +create table t1(a integer unique key) engine=innodb; ERROR 42000: This table type requires a primary key -SHOW WARNINGS; +show warnings; Level Code Message Error 1173 This table type requires a primary key -CREATE TABLE T1(A INTEGER NOT NULL, B INTEGER, -UNIQUE KEY(A,B)) ENGINE=INNODB; +create table t1(a integer not null, b integer, +unique key(a,b)) engine=innodb; ERROR 42000: This table type requires a primary key -SHOW WARNINGS; +show warnings; Level Code Message Error 1173 This table type requires a primary key -CREATE TABLE T1(A INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; -SHOW CREATE TABLE T1; +create table t1(a integer not null primary key) engine=innodb; +show create table t1; Table Create Table -T1 CREATE TABLE `T1` ( - `A` int(11) NOT NULL, - PRIMARY KEY (`A`) +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW WARNINGS; +show warnings; Level Code Message -DROP TABLE T1; -CREATE TABLE T1(A INTEGER NOT NULL UNIQUE KEY) ENGINE=INNODB; -SHOW CREATE TABLE T1; +drop table t1; +create table t1(a integer not null unique key) engine=innodb; +show create table t1; Table Create Table -T1 CREATE TABLE `T1` ( - `A` int(11) NOT NULL, - UNIQUE KEY `A` (`A`) +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + UNIQUE KEY `a` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW WARNINGS; +show warnings; Level Code Message -DROP TABLE T1; +drop table t1; set global innodb_force_primary_key = 0; -CREATE TABLE T1(A INTEGER) ENGINE=INNODB; -SHOW WARNINGS; +create table t1(a integer) engine=innodb; +show warnings; Level Code Message -INSERT INTO T1 VALUES (1),(2),(3); +insert into t1 values (1),(2),(3); set global innodb_force_primary_key = 1; -SELECT * FROM T1; -A +select * from t1; +a 1 2 3 -CREATE TABLE T2(A INTEGER) ENGINE=INNODB; +create table t2(a integer) engine=innodb; ERROR 42000: This table type requires a primary key -SHOW WARNINGS; +show warnings; Level Code Message Error 1173 This table type requires a primary key -DROP TABLE T1; +drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test b/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test index 1290b9b5bb7..4b03ac008d2 100644 --- a/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test +++ b/mysql-test/suite/innodb/t/innodb-wl5522-debug-zip.test @@ -22,7 +22,7 @@ let MYSQLD_DATADIR =`SELECT @@datadir`; let $innodb_file_per_table = `SELECT @@innodb_file_per_table`; let $innodb_file_format = `SELECT @@innodb_file_format`; let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`; -let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522\\t1.ibd'/; +let $pathfix=/: '.*test_wl5522.*t1.ibd'/: 'test_wl5522_t1.ibd'/; SET GLOBAL innodb_file_per_table = 1; SELECT @@innodb_file_per_table; @@ -233,8 +233,7 @@ SET SESSION debug_dbug="-d,ib_import_reset_space_and_lsn_failure"; # Test failure after attempting a tablespace open SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ---replace_regex /file: '.*t1.ibd'/'t1.ibd'/ - +--replace_regex /'.*[\/\\]/'/ --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; @@ -637,8 +636,7 @@ EOF SET SESSION debug_dbug="+d,fil_space_create_failure"; ---replace_regex $pathfix - +--replace_regex /'.*[\/\\]/'/ --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; @@ -669,8 +667,7 @@ EOF SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; ---replace_regex $pathfix - +--replace_regex /'.*[\/\\]/'/ --error ER_GET_ERRMSG ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; diff --git a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test index 24c23448a30..a46ca124f51 100644 --- a/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test +++ b/mysql-test/suite/innodb/t/innodb_defragment_fill_factor.test @@ -2,47 +2,62 @@ --source include/big_test.inc --source include/not_valgrind.inc --source include/not_embedded.inc +--source include/have_innodb_16k.inc --disable_warnings DROP TABLE if exists t1; DROP TABLE if exists t2; --enable_warnings + --echo Testing tables with large records # Create table. CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256), KEY SECOND(a, b)) ENGINE=INNODB; + # Populate table. -let $i = 1000; ---disable_query_log -while ($i) -{ - eval - INSERT INTO t1 VALUES ($i, REPEAT('A', 256)); - dec $i; -} ---enable_query_log +INSERT INTO t1 VALUES (1, REPEAT('A', 256)); +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; +INSERT INTO t1 (b) SELECT b from t1; + --disable_query_log let $size = 10; while ($size) { let $j = 100 * $size; - eval delete from t1 where a between $j - 20 and $j; + eval delete from t1 where a between $j - 20 and $j + 5; dec $size; } --enable_query_log + +--source include/restart_mysqld.inc optimize table t1; +select sleep(1); + --source include/restart_mysqld.inc select count(*) from t1; + # After deletion & defragmentation, there are 800 records left. Each page can hold about 57 records. We fill the page 90% full, # so there should be less than 16 pages total. --let $primary_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) + select count(*) from t1 force index (second); + # secondary index is slightly bigger than primary index so the number of pages should be similar. --let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) --echo # A few more insertions on the page should not cause a page split. insert into t1 values (81, REPEAT('A', 256)); insert into t1 values (83, REPEAT('A', 256)); - +insert into t1 values (87, REPEAT('A', 256)); +insert into t1 values (82, REPEAT('A', 256)); +insert into t1 values (86, REPEAT('A', 256)); --let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) @@ -55,14 +70,9 @@ if ($second_before != $second_after) { } --echo # More insertions will cause page splits -insert into t1 values (88, REPEAT('A', 50)); +insert into t1 values (88, REPEAT('A', 256)); insert into t1 values (85, REPEAT('A', 256)); insert into t1 values (84, REPEAT('A', 256)); -insert into t1 values (87, REPEAT('A', 256)); -insert into t1 values (89, REPEAT('A', 256)); -insert into t1 values (82, REPEAT('A', 256)); -insert into t1 values (86, REPEAT('A', 256)); - --let $primary_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'PRIMARY', Value, 1) --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t1%' and index_name = 'second', Value, 1) @@ -94,6 +104,7 @@ INSERT INTO t2 (b) SELECT b from t2; INSERT INTO t2 (b) SELECT b from t2; INSERT INTO t2 (b) SELECT b from t2; --enable_query_log + --disable_query_log let $size = 40; while ($size) @@ -103,10 +114,16 @@ while ($size) dec $size; } --enable_query_log + +--source include/restart_mysqld.inc optimize table t2; +select sleep(1); + --source include/restart_mysqld.inc select count(*) from t2 force index(second); + --let $second_before = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) + --echo The page should have room for about 20 insertions insert into t2 values(1181, REPEAT('A', 16)); insert into t2 values(1191, REPEAT('A', 16)); @@ -125,6 +142,9 @@ insert into t2 values(1197, REPEAT('A', 16)); insert into t2 values(1188, REPEAT('A', 16)); insert into t2 values(1198, REPEAT('A', 16)); insert into t2 values(1189, REPEAT('A', 16)); +insert into t2 values(1199, REPEAT('A', 16)); +insert into t2 values(1190, REPEAT('A', 16)); +insert into t2 values(1180, REPEAT('A', 16)); --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) @@ -137,18 +157,10 @@ insert into t2 values(1280, REPEAT('A', 16)); insert into t2 values(1290, REPEAT('A', 16)); insert into t2 values(1281, REPEAT('A', 16)); insert into t2 values(1291, REPEAT('A', 16)); -insert into t2 values(1199, REPEAT('A', 16)); -insert into t2 values(1190, REPEAT('A', 16)); -insert into t2 values(1180, REPEAT('A', 16)); -insert into t2 values(1295, REPEAT('A', 16)); -insert into t2 values(1294, REPEAT('A', 16)); -insert into t2 values(1292, REPEAT('A', 16)); -insert into t2 values(1293, REPEAT('A', 16)); --let $second_after = query_get_value(select count(*) as Value from information_schema.innodb_buffer_page where table_name like '%t2%' and index_name = 'second', Value, 1) - if ($second_before == $second_after) { --echo Too much space are reserved on second index. } -DROP TABLE t2; +DROP TABLE t2; \ No newline at end of file diff --git a/mysql-test/suite/innodb/t/innodb_force_pk.test b/mysql-test/suite/innodb/t/innodb_force_pk.test index 4361a58d2f5..48986ca2fee 100644 --- a/mysql-test/suite/innodb/t/innodb_force_pk.test +++ b/mysql-test/suite/innodb/t/innodb_force_pk.test @@ -3,35 +3,35 @@ let $force_pk=`select @@innodb_force_primary_key`; -- error 1173 -CREATE TABLE T1(A INTEGER) ENGINE=INNODB; -SHOW WARNINGS; +create table t1(a integer) engine=innodb; +show warnings; -- error 1173 -CREATE TABLE T1(A INTEGER UNIQUE KEY) ENGINE=INNODB; -SHOW WARNINGS; +create table t1(a integer unique key) engine=innodb; +show warnings; -- error 1173 -CREATE TABLE T1(A INTEGER NOT NULL, B INTEGER, -UNIQUE KEY(A,B)) ENGINE=INNODB; -SHOW WARNINGS; -CREATE TABLE T1(A INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; -SHOW CREATE TABLE T1; -SHOW WARNINGS; -DROP TABLE T1; -CREATE TABLE T1(A INTEGER NOT NULL UNIQUE KEY) ENGINE=INNODB; -SHOW CREATE TABLE T1; -SHOW WARNINGS; -DROP TABLE T1; +create table t1(a integer not null, b integer, +unique key(a,b)) engine=innodb; +show warnings; +create table t1(a integer not null primary key) engine=innodb; +show create table t1; +show warnings; +drop table t1; +create table t1(a integer not null unique key) engine=innodb; +show create table t1; +show warnings; +drop table t1; set global innodb_force_primary_key = 0; -CREATE TABLE T1(A INTEGER) ENGINE=INNODB; -SHOW WARNINGS; -INSERT INTO T1 VALUES (1),(2),(3); +create table t1(a integer) engine=innodb; +show warnings; +insert into t1 values (1),(2),(3); set global innodb_force_primary_key = 1; -SELECT * FROM T1; +select * from t1; -- error 1173 -CREATE TABLE T2(A INTEGER) ENGINE=INNODB; -SHOW WARNINGS; -DROP TABLE T1; +create table t2(a integer) engine=innodb; +show warnings; +drop table t1; --disable_query_log eval set global innodb_force_primary_key=$force_pk;