summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2010-04-28 14:52:24 +0200
committerunknown <knielsen@knielsen-hq.org>2010-04-28 14:52:24 +0200
commit11fe627e3f0ecf45abdb49f3b92cca88b12465e7 (patch)
treebb1fdd7363fbf2580572ac9a56dbd4c933cc4c0d /mysql-test/suite/innodb/t
parentc805d9bc0b127e1126eeb7814d5ff5d66a539b47 (diff)
parentba192d38bda55ac8b2cf3ccc5a6338e053ccddb1 (diff)
downloadmariadb-git-11fe627e3f0ecf45abdb49f3b92cca88b12465e7.tar.gz
Merge MySQL 5.1.46 into MariaDB.mariadb-merge-mysql-5.1.46
Still two test failures to be solved: main.myisam and main.subselect.
Diffstat (limited to 'mysql-test/suite/innodb/t')
-rw-r--r--mysql-test/suite/innodb/t/innodb-consistent.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test8
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug44571.test17
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug47622.test55
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug51378.test77
5 files changed, 152 insertions, 9 deletions
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;
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index b5dd2e037e7..eeadc0f4783 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;
@@ -139,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
@@ -146,7 +150,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;
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;
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;
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;