From 1c16f4252dae8c1f8049559d94cc180206d2a54b Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 15:25:06 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6472 | calvin | 2010-01-16 01:53:47 +0200 (Sat, 16 Jan 2010) | 12 lines branches/zip: Merge revisions 6425:6471 from branches/5.1 to pick up the first part fix of bug49396. ------------------------------------------------------------------------ r6471 | calvin | 2010-01-15 17:43:27 -0600 (Fri, 15 Jan 2010) | 4 lines branches/5.1: fix bug#49396: main.innodb test fails in embedded mode Change replace_result by using $MYSQLD_DATADIR. Tested in both embedded mode and normal server mode. ------------------------------------------------------------------------ r6473 | calvin | 2010-01-16 01:58:16 +0200 (Sat, 16 Jan 2010) | 6 lines branches/zip: fix bug#49396: innodb.innodb-index test fails in embedded mode This is 2nd part of the fix for bug#49396. The 1st part is innodb.test. Tested in both embedded mode and normal server mode. --- mysql-test/suite/innodb/t/innodb-index.test | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index b5dd2e037e7..09d6e2f8e3f 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -1,5 +1,7 @@ -- source include/have_innodb.inc +let $MYSQLD_DATADIR= `select @@datadir`; + let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb; @@ -146,7 +148,9 @@ delete from t1; --error ER_CANT_DROP_FIELD_OR_KEY drop index dc on t4; # there is no foreign key dc on t3 ---replace_regex /'\.\/test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/ +--replace_regex /'[^']*test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/ +# Embedded server doesn't chdir to data directory +--replace_result $MYSQLD_DATADIR ./ master-data/ '' --error ER_ERROR_ON_RENAME alter table t3 drop foreign key dc; alter table t4 drop foreign key dc; -- cgit v1.2.1 From f121ceea14bc416705c32212d8621b9bd8cc36ef Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 15:30:11 +0400 Subject: Applying InnoDB snapshot, fixes BUG#47622. Detailed revision comments: r6526 | jyang | 2010-01-28 18:12:40 +0200 (Thu, 28 Jan 2010) | 8 lines branches/zip: Add index translation table to map mysql index number to InnoDB index structure directly. Fix Bug #47622: "the new index is added before the existing ones in MySQL, but after one in SE". rb://215, approved by Marko --- mysql-test/suite/innodb/t/innodb_bug47622.test | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 mysql-test/suite/innodb/t/innodb_bug47622.test (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/innodb_bug47622.test b/mysql-test/suite/innodb/t/innodb_bug47622.test new file mode 100644 index 00000000000..9cf9d0e531b --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug47622.test @@ -0,0 +1,55 @@ +# This is the test for bug 47622. There could be index +# metadata sequence mismatch between MySQL and Innodb +# after creating index through FIC interfaces. +# We resolve the problem by sync the index sequence +# up when opening the table. + +--source include/have_innodb.inc + +connect (a,localhost,root,,); +connect (b,localhost,root,,); + +# Create a table with a non-unique index +CREATE TABLE bug47622( + `rule_key` int(11) NOT NULL DEFAULT '0', + `seq` smallint(6) NOT NULL DEFAULT '0', + `action` smallint(6) NOT NULL DEFAULT '0', + `arg_id` smallint(6) DEFAULT NULL, + `else_ind` TINYINT NOT NULL, + KEY IDX_A (`arg_id`) +) ENGINE=InnoDB; + +connection a; + +# A subsequent creating unique index should not trigger +# any error message. Unique index would be ranked ahead +# of regular index. +ALTER TABLE bug47622 ADD UNIQUE IDX_B (rule_key,else_ind,seq,action,arg_id); + +drop index IDX_B on bug47622; + +# In another connection, create additional set of normal +# index and unique index. Again, unique index would be ranked +# ahead of regular index. +connection b; +create index idx on bug47622(seq, arg_id); + +ALTER TABLE bug47622 ADD UNIQUE IDX_X (rule_key,else_ind,seq,action); + +drop table bug47622; + +# Create a table with one Primary key and a non-unique key +CREATE TABLE bug47622 ( + `a` int(11) NOT NULL, + `b` int(11) DEFAULT NULL, + `c` char(10) DEFAULT NULL, + `d` varchar(20) DEFAULT NULL, + PRIMARY KEY (`a`), + KEY `b` (`b`) +) ENGINE=InnoDB; + +# Add two index with one unique and one non-unique. +# Index sequence is "PRIMARY", "c", "b" and "d" +alter table bug47622 add unique index (c), add index (d); + +drop table bug47622; -- cgit v1.2.1 From ba8849da3def83f0bffb3ad24663220b9b137126 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 16:04:43 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6770 | marko | 2010-03-03 12:52:55 +0200 (Wed, 03 Mar 2010) | 12 lines branches/zip: Disallow duplicate index name when creating an index. This should fix Mantis Issue #461. innodb.test, innodb.result, innodb-index.test, innodb-index.result: Adjust the test result and mention that the introduced restriction has been reported as MySQL Bug #51451. innobase_check_index_keys(): Add a parameter for the InnoDB table and check that no duplicate index name is added. Report errors by my_error() instead of sql_print_error(). rb://260 approved by Sunny Bains --- mysql-test/suite/innodb/t/innodb-index.test | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index 09d6e2f8e3f..eeadc0f4783 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -141,6 +141,8 @@ show create table t4; --error ER_CANT_CREATE_TABLE alter table t3 add constraint dc foreign key (a) references t1(a); show create table t3; +# this should be fixed by MySQL (see Bug #51451) +--error ER_WRONG_NAME_FOR_INDEX alter table t2 drop index b, add index (b); show create table t2; --error ER_ROW_IS_REFERENCED_2 -- cgit v1.2.1 From bd046ce3adf21d492f0ccb7e44d5ab66e966d61b Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 16:07:40 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6786 | vasil | 2010-03-10 09:16:50 +0200 (Wed, 10 Mar 2010) | 4 lines branches/zip: Fix typo in comment --- mysql-test/suite/innodb/t/innodb-consistent.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/innodb-consistent.test b/mysql-test/suite/innodb/t/innodb-consistent.test index b58d0cb0e62..25bdf78e96b 100644 --- a/mysql-test/suite/innodb/t/innodb-consistent.test +++ b/mysql-test/suite/innodb/t/innodb-consistent.test @@ -26,7 +26,7 @@ replace into t1 select * from t2; connection b; set session transaction isolation level read committed; set autocommit=0; -# should not cuase a lock wait. +# should not cause a lock wait. delete from t2 where a=5; commit; delete from t2; @@ -42,7 +42,7 @@ insert into t1 select * from t2; connection b; set session transaction isolation level read committed; set autocommit=0; -# should not cuase a lock wait. +# should not cause a lock wait. delete from t2 where a=5; commit; delete from t2; -- cgit v1.2.1 From 82a8fb1e134db81e02fc0d96dd2a95d57d345805 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 16:14:51 +0400 Subject: Applying InnoDB snapshot, fixes BUG#51356. Detailed revision comments: r6790 | jyang | 2010-03-10 13:09:41 +0200 (Wed, 10 Mar 2010) | 7 lines branches/zip: Fix bug #51356: "many valgrind errors in error messages with concurrent ddl". Null terminate the name string returned from innobase_convert_identifier() call when reporting DB_DUPLICATE_KEY error in create_table_def(). rb://266 approved by Marko --- mysql-test/suite/innodb/t/innodb_bug51378.test | 77 ++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 mysql-test/suite/innodb/t/innodb_bug51378.test (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/innodb_bug51378.test b/mysql-test/suite/innodb/t/innodb_bug51378.test new file mode 100644 index 00000000000..8f7b0b9605a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_bug51378.test @@ -0,0 +1,77 @@ +# This is the test for bug 51378. Unique index created +# through "create index" and "alter table add unique index" +# interfaces should not be treated as primary index if indexed +# columns contain one or more column prefix(es) (only prefix/part of +# the column is indexed) +# On the other hand, if there is a unique index covers all +# columns of a table, and they are non-null columns, and +# full length of the column are indexed, then this index +# will be created as primary index +# Following queries test various scenario, no mismatch +# error message should be printed. +--source include/have_innodb.inc + +# Create a table contains a BLOB column +create table bug51378 ( + col1 int not null, + col2 blob not null, + col3 time not null) engine = innodb; + +# Create following unique indexes on 'col1' and 'col2(31)' +# of the table, the index should not be treated as primary +# key because it indexes only first 31 bytes of col2. +# Thus it contains "column prefix", and will not be +# upgraded to primary index. +# There should not be mismatch message printed in the +# errorlog +create unique index idx on bug51378(col1, col2(31)); + +alter table bug51378 add unique index idx2(col1, col2(31)); + +# Unique index on 'col1' and 'col3' will be created as primary index, +# since the index does not contain column prefix +create unique index idx3 on bug51378(col1, col3); + +# Show create table would show idx3 created as unique index, internally, +# idx3 is treated as primary index both by MySQL and Innodb +SHOW CREATE TABLE bug51378; + +# "GEN_CLUST_INDEX" will be re-created as default primary index +# after idx3 is dropped +drop index idx3 on bug51378; + +SHOW CREATE TABLE bug51378; + +# Or we can add the primary key through alter table interfaces +alter table bug51378 add primary key idx3(col1, col2(31)); + +SHOW CREATE TABLE bug51378; + +drop table bug51378; + +# Or we can create such primary key through create table interfaces +create table bug51378 ( + col1 int not null, + col2 blob not null, + col3 time not null, primary key(col1, col2(31))) engine = innodb; + +# Unique index on one or more column prefix(es) will be created +# as non-cluster index +create unique index idx on bug51378(col1, col2(31)); + +SHOW CREATE TABLE bug51378; + +drop table bug51378; + +# If a table has a NULLABLE column, unique index on it will not +# be treated as primary index. +create table bug51378 ( + col1 int not null, + col2 int ) engine = innodb; + +# This will be created as non-cluster index since col2 is nullable +create unique index idx on bug51378(col1, col2); + +SHOW CREATE TABLE bug51378; + +drop table bug51378; -- cgit v1.2.1 From 398331f3560269fc24d193b2860a60cbfcf7b94a Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 1 Apr 2010 16:27:13 +0400 Subject: Applying InnoDB snapshot Detailed revision comments: r6800 | marko | 2010-03-11 12:02:57 +0200 (Thu, 11 Mar 2010) | 1 line branches/zip: Add ut_ad(mtr->state == MTR_ACTIVE) to various places. --- mysql-test/suite/innodb/t/innodb_bug44571.test | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'mysql-test/suite/innodb/t') diff --git a/mysql-test/suite/innodb/t/innodb_bug44571.test b/mysql-test/suite/innodb/t/innodb_bug44571.test index 43f290cde84..58f02dfb5d2 100644 --- a/mysql-test/suite/innodb/t/innodb_bug44571.test +++ b/mysql-test/suite/innodb/t/innodb_bug44571.test @@ -1,18 +1,23 @@ # # Bug#44571 InnoDB Plugin crashes on ADD INDEX # http://bugs.mysql.com/44571 +# Please also refer to related fix in +# http://bugs.mysql.com/47621 # -- source include/have_innodb.inc -- source suite/innodb/include/have_innodb_plugin.inc CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; ALTER TABLE bug44571 CHANGE foo bar INT; +# Create index with the old column name will fail, +# because the CHANGE foo bar is successful. And +# the column name change would communicate to +# InnoDB with the fix from bug #47621 -- error ER_KEY_COLUMN_DOES_NOT_EXITS ALTER TABLE bug44571 ADD INDEX bug44571b (foo); -# The following will fail, because the CHANGE foo bar was -# not communicated to InnoDB. ---error ER_NOT_KEYFILE -ALTER TABLE bug44571 ADD INDEX bug44571b (bar); ---error ER_NOT_KEYFILE -CREATE INDEX bug44571b ON bug44571 (bar); +# The following create indexes should succeed, +# indirectly confirm the CHANGE foo bar is successful. +ALTER TABLE bug44571 ADD INDEX bug44571c (bar); +DROP INDEX bug44571c ON bug44571; +CREATE INDEX bug44571c ON bug44571 (bar); DROP TABLE bug44571; -- cgit v1.2.1