Commit fb0c4b14 authored by Vasil Dimov's avatar Vasil Dimov

Move InnoDB tests from storage/innobase/mysql-test/ (where they were ignored)

to mysql-test/
parent 03bfca85
...@@ -868,35 +868,6 @@ Got one of the listed errors ...@@ -868,35 +868,6 @@ Got one of the listed errors
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
d1
1
2
SELECT * FROM t1;
d1
1
2
INSERT INTO t1 VALUES(null);
Got one of the listed errors
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`d1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`d1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
d1
1
2
3
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%"; SHOW VARIABLES LIKE "%auto_inc%";
Variable_name Value Variable_name Value
auto_increment_increment 1 auto_increment_increment 1
...@@ -1111,18 +1082,165 @@ c1 c2 ...@@ -1111,18 +1082,165 @@ c1 c2
3 innodb 3 innodb
4 NULL 4 NULL
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2); CREATE INDEX i1 on t1(c2);
SHOW CREATE TABLE T1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
T1 CREATE TABLE `T1` ( t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT, `c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`), PRIMARY KEY (`c1`),
KEY `i1` (`c2`) KEY `i1` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
INSERT INTO T1 (c2) values (0); INSERT INTO t1 (c2) values (0);
SELECT * FROM T1; SELECT * FROM t1;
c1 c2 c1 c2
10 0 10 0
DROP TABLE T1; DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`C1` double NOT NULL AUTO_INCREMENT,
`C2` char(10) DEFAULT NULL,
PRIMARY KEY (`C1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`C1` float NOT NULL AUTO_INCREMENT,
`C2` char(10) DEFAULT NULL,
PRIMARY KEY (`C1`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 SET c1 = 1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
INSERT INTO t1 SET c1 = 2;
INSERT INTO t1 SET c1 = -1;
SELECT * FROM t1;
c1
-1
1
2
INSERT INTO t1 SET c1 = -1;
Got one of the listed errors
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
REPLACE INTO t1 VALUES (-1);
SELECT * FROM t1;
c1
-1
1
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
SELECT * FROM t1;
c1
-685113344
2
3
4
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
4
5
6
7
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
SELECT * FROM t1;
c1
-685113344
1
2
5
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
SELECT * FROM t1;
c1
-685113344
1
2
3
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
...@@ -25,12 +25,6 @@ id x ...@@ -25,12 +25,6 @@ id x
0 2 0 2
commit; commit;
drop table t1; drop table t1;
#
# Old lock method (where LOCK TABLE was ignored by InnoDB) no longer
# works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary
# deadlock" and bug #37346 "innodb does not detect deadlock between
# update and alter table".
#
set @@innodb_table_locks=0; set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB; create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2); insert into t1 values(0, 0),(1,1),(2,2);
...@@ -38,27 +32,26 @@ commit; ...@@ -38,27 +32,26 @@ commit;
SELECT * from t1 where id = 0 FOR UPDATE; SELECT * from t1 where id = 0 FOR UPDATE;
id x id x
0 0 0 0
# Connection 'con2'.
set autocommit=0; set autocommit=0;
set @@innodb_table_locks=0; set @@innodb_table_locks=0;
# The following statement should block because SQL-level lock lock table t1 write;
# is taken on t1 which will wait until concurrent transaction update t1 set x=10 where id = 2;
# is commited. SELECT * from t1 where id = 2;
# Sending:
lock table t1 write;;
# Connection 'con1'.
# Wait until LOCK TABLE is blocked on SQL-level lock.
# We should be able to do UPDATEs and SELECTs within transaction.
update t1 set x=1 where id = 0;
select * from t1;
id x id x
0 1
1 1
2 2 2 2
# Unblock LOCK TABLE. UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
id x
0 0
1 1
2 3
commit; commit;
# Connection 'con2'.
# Reap LOCK TABLE.
unlock tables; unlock tables;
# Connection 'con1'. commit;
select * from t1;
id x
0 0
1 1
2 10
drop table t1; drop table t1;
...@@ -692,6 +692,9 @@ select count(*) from t1 where sca_pic is null; ...@@ -692,6 +692,9 @@ select count(*) from t1 where sca_pic is null;
count(*) count(*)
2 2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*) count(*)
1 1
...@@ -699,6 +702,9 @@ select count(*) from t1 where cat_code='E'; ...@@ -699,6 +702,9 @@ select count(*) from t1 where cat_code='E';
count(*) count(*)
0 0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code); alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*) count(*)
1 1
...@@ -1738,7 +1744,7 @@ count(*) ...@@ -1738,7 +1744,7 @@ count(*)
drop table t1; drop table t1;
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
variable_value variable_value
512 8191
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
variable_value variable_value
16384 16384
...@@ -1788,7 +1794,7 @@ Variable_name Value ...@@ -1788,7 +1794,7 @@ Variable_name Value
innodb_thread_concurrency 0 innodb_thread_concurrency 0
set global innodb_thread_concurrency=1001; set global innodb_thread_concurrency=1001;
Warnings: Warnings:
Warning 1292 Truncated incorrect innodb_thread_concurrency value: '1001' Warning 1292 Truncated incorrect thread_concurrency value: '1001'
show variables like "innodb_thread_concurrency"; show variables like "innodb_thread_concurrency";
Variable_name Value Variable_name Value
innodb_thread_concurrency 1000 innodb_thread_concurrency 1000
...@@ -1809,7 +1815,7 @@ Variable_name Value ...@@ -1809,7 +1815,7 @@ Variable_name Value
innodb_concurrency_tickets 1000 innodb_concurrency_tickets 1000
set global innodb_concurrency_tickets=0; set global innodb_concurrency_tickets=0;
Warnings: Warnings:
Warning 1292 Truncated incorrect innodb_concurrency_tickets value: '0' Warning 1292 Truncated incorrect concurrency_tickets value: '0'
show variables like "innodb_concurrency_tickets"; show variables like "innodb_concurrency_tickets";
Variable_name Value Variable_name Value
innodb_concurrency_tickets 1 innodb_concurrency_tickets 1
...@@ -1833,6 +1839,7 @@ show variables like "innodb_thread_sleep_delay"; ...@@ -1833,6 +1839,7 @@ show variables like "innodb_thread_sleep_delay";
Variable_name Value Variable_name Value
innodb_thread_sleep_delay 10000 innodb_thread_sleep_delay 10000
set storage_engine=INNODB; set storage_engine=INNODB;
set session old_alter_table=1;
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
--- Testing varchar --- --- Testing varchar ---
--- Testing varchar --- --- Testing varchar ---
...@@ -1970,7 +1977,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' ...@@ -1970,7 +1977,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index 1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v); alter table t1 add unique(v);
ERROR 23000: Duplicate entry 'v' for key 'v_2' ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v); alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq qq
...@@ -2406,6 +2413,7 @@ select * from t1 where a=20 and b is null; ...@@ -2406,6 +2413,7 @@ select * from t1 where a=20 and b is null;
a b a b
20 NULL 20 NULL
drop table t1; drop table t1;
set session old_alter_table=0;
create table t1 (v varchar(65530), key(v)); create table t1 (v varchar(65530), key(v));
Warnings: Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes Warning 1071 Specified key was too long; max key length is 767 bytes
...@@ -2723,7 +2731,7 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; ...@@ -2723,7 +2731,7 @@ create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
insert into t1 values (0x41),(0x4120),(0x4100); insert into t1 values (0x41),(0x4120),(0x4100);
insert into t2 values (0x41),(0x4120),(0x4100); insert into t2 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A\x00' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
insert into t2 values (0x41),(0x4120); insert into t2 values (0x41),(0x4120);
insert into t3 values (0x41),(0x4120),(0x4100); insert into t3 values (0x41),(0x4120),(0x4100);
ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
...@@ -2834,10 +2842,10 @@ t2 CREATE TABLE `t2` ( ...@@ -2834,10 +2842,10 @@ t2 CREATE TABLE `t2` (
DROP TABLE t2,t1; DROP TABLE t2,t1;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3); insert into t1(a) values (1),(2),(3);
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
commit; commit;
set autocommit = 0; set autocommit = 0;
update t1 set b = 5 where a = 2; update t1 set b = 5 where a = 2;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
set autocommit = 0; set autocommit = 0;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), (11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
...@@ -2885,7 +2893,6 @@ insert into t2(a) values(8); ...@@ -2885,7 +2893,6 @@ insert into t2(a) values(8);
delete from t2 where a = 3; delete from t2 where a = 3;
update t4 set b = b + 1 where a = 3; update t4 set b = b + 1 where a = 3;
commit; commit;
commit;
drop trigger t1t; drop trigger t1t;
drop trigger t2t; drop trigger t2t;
drop trigger t3t; drop trigger t3t;
......
...@@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT; ...@@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150) ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works. # Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT; ALTER TABLE t1 CHANGE b c INT;
affected rows: 0 affected rows: 3
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table # Test renaming the column in the referencing table
...@@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT; ...@@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150) ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works. # Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT; ALTER TABLE t2 CHANGE b c INT;
affected rows: 0 affected rows: 3
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
# Test with self-referential constraints # Test with self-referential constraints
...@@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT; ...@@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150) ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works. # Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT; ALTER TABLE t3 CHANGE c d INT;
affected rows: 0 affected rows: 3
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 3 Duplicates: 0 Warnings: 0
# Cleanup. # Cleanup.
......
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '0' ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
1 1
...@@ -16,7 +16,7 @@ select @@innodb_commit_concurrency; ...@@ -16,7 +16,7 @@ select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
1 1
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '0' ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
1 1
......
...@@ -3,12 +3,12 @@ select @@innodb_commit_concurrency; ...@@ -3,12 +3,12 @@ select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
0 0
set global innodb_commit_concurrency=1; set global innodb_commit_concurrency=1;
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '1' ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
0 0
set global innodb_commit_concurrency=42; set global innodb_commit_concurrency=42;
ERROR 42000: Variable 'innodb_commit_concurrency' can't be set to the value of '42' ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
0 0
......
...@@ -2,8 +2,7 @@ CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; ...@@ -2,8 +2,7 @@ CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
ALTER TABLE bug44571 CHANGE foo bar INT; ALTER TABLE bug44571 CHANGE foo bar INT;
ALTER TABLE bug44571 ADD INDEX bug44571b (foo); ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
ERROR 42000: Key column 'foo' doesn't exist in table ERROR 42000: Key column 'foo' doesn't exist in table
ALTER TABLE bug44571 ADD INDEX bug44571b (bar); ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it DROP INDEX bug44571c ON bug44571;
CREATE INDEX bug44571b ON bug44571 (bar); CREATE INDEX bug44571c ON bug44571 (bar);
ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
DROP TABLE bug44571; DROP TABLE bug44571;
...@@ -478,28 +478,6 @@ INSERT INTO t2 SELECT c1 FROM t1; ...@@ -478,28 +478,6 @@ INSERT INTO t2 SELECT c1 FROM t1;
INSERT INTO t2 SELECT NULL FROM t1; INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
#
# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
# the index (PRIMARY)
# This test requires a restart of the server
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (null);
INSERT INTO t1 VALUES (null);
ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
SELECT * FROM t1;
# Restart the server
-- source include/restart_mysqld.inc
# The MySQL and InnoDB data dictionaries should now be out of sync.
# The select should print message to the error log
SELECT * FROM t1;
-- error ER_AUTOINC_READ_FAILED,1467
INSERT INTO t1 VALUES(null);
ALTER TABLE t1 AUTO_INCREMENT = 3;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
# If the user has specified negative values for an AUTOINC column then # If the user has specified negative values for an AUTOINC column then
# InnoDB should ignore those values when setting the table's max value. # InnoDB should ignore those values when setting the table's max value.
...@@ -610,9 +588,77 @@ DROP TABLE t1; ...@@ -610,9 +588,77 @@ DROP TABLE t1;
# 47125: auto_increment start value is ignored if an index is created # 47125: auto_increment start value is ignored if an index is created
# and engine=innodb # and engine=innodb
# #
CREATE TABLE T1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB; CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
CREATE INDEX i1 on T1(c2); CREATE INDEX i1 on t1(c2);
SHOW CREATE TABLE T1; SHOW CREATE TABLE t1;
INSERT INTO T1 (c2) values (0); INSERT INTO t1 (c2) values (0);
SELECT * FROM T1; SELECT * FROM t1;
DROP TABLE T1; DROP TABLE t1;
##
# 49032: Use the correct function to read the AUTOINC column value
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
# Restart the server
-- source include/restart_mysqld.inc
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
# Restart the server
-- source include/restart_mysqld.inc
INSERT INTO t1(C2) VALUES ('innodb');
SHOW CREATE TABLE t1;
DROP TABLE t1;
##
# 47720: REPLACE INTO Autoincrement column with negative values
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 SET c1 = 1;
SHOW CREATE TABLE t1;
INSERT INTO t1 SET c1 = 2;
INSERT INTO t1 SET c1 = -1;
SELECT * FROM t1;
-- error ER_DUP_ENTRY,1062
INSERT INTO t1 SET c1 = -1;
SHOW CREATE TABLE t1;
REPLACE INTO t1 VALUES (-1);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
##
# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--innodb_lock_wait_timeout=2 --loose-innodb_lock_wait_timeout=2
...@@ -25,7 +25,7 @@ replace into t1 select * from t2; ...@@ -25,7 +25,7 @@ replace into t1 select * from t2;
connection b; connection b;
set session transaction isolation level read committed; set session transaction isolation level read committed;
set autocommit=0; set autocommit=0;
# should not cuase a lock wait. # should not cause a lock wait.
delete from t2 where a=5; delete from t2 where a=5;
commit; commit;
delete from t2; delete from t2;
...@@ -41,7 +41,7 @@ insert into t1 select * from t2; ...@@ -41,7 +41,7 @@ insert into t1 select * from t2;
connection b; connection b;
set session transaction isolation level read committed; set session transaction isolation level read committed;
set autocommit=0; set autocommit=0;
# should not cuase a lock wait. # should not cause a lock wait.
delete from t2 where a=5; delete from t2 where a=5;
commit; commit;
delete from t2; delete from t2;
......
...@@ -56,12 +56,9 @@ commit; ...@@ -56,12 +56,9 @@ commit;
drop table t1; drop table t1;
--echo # #
--echo # Old lock method (where LOCK TABLE was ignored by InnoDB) no longer # Try with old lock method (where LOCK TABLE is ignored by InnoDB)
--echo # works due to fix for bugs #46272 "MySQL 5.4.4, new MDL: unnecessary #
--echo # deadlock" and bug #37346 "innodb does not detect deadlock between
--echo # update and alter table".
--echo #
set @@innodb_table_locks=0; set @@innodb_table_locks=0;
...@@ -70,38 +67,36 @@ insert into t1 values(0, 0),(1,1),(2,2); ...@@ -70,38 +67,36 @@ insert into t1 values(0, 0),(1,1),(2,2);
commit; commit;
SELECT * from t1 where id = 0 FOR UPDATE; SELECT * from t1 where id = 0 FOR UPDATE;
--echo # Connection 'con2'.
connection con2; connection con2;
set autocommit=0; set autocommit=0;
set @@innodb_table_locks=0; set @@innodb_table_locks=0;
--echo # The following statement should block because SQL-level lock # The following statement should work becase innodb doesn't check table locks
--echo # is taken on t1 which will wait until concurrent transaction lock table t1 write;
--echo # is commited.
--echo # Sending:
--send lock table t1 write;
--echo # Connection 'con1'.
connection con1; connection con1;
--echo # Wait until LOCK TABLE is blocked on SQL-level lock.
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table" and info = "lock table t1 write";
--source include/wait_condition.inc
--echo # We should be able to do UPDATEs and SELECTs within transaction.
update t1 set x=1 where id = 0;
select * from t1;
--echo # Unblock LOCK TABLE.
commit;
--echo # Connection 'con2'. # This will be locked by MySQL
--send
update t1 set x=10 where id = 2;
--sleep 2
connection con2; connection con2;
--echo # Reap LOCK TABLE.
--reap # Note that we will get a deadlock if we try to select any rows marked
# for update by con1 !
SELECT * from t1 where id = 2;
UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
commit;
unlock tables; unlock tables;
--echo # Connection 'con1'.
connection con1; connection con1;
reap;
commit;
select * from t1;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
let $MYSQLD_DATADIR= `select @@datadir`;
# Save the original values of some variables in order to be able to # Save the original values of some variables in order to be able to
# estimate how much they have changed during the tests. Previously this # estimate how much they have changed during the tests. Previously this
# test assumed that e.g. rows_deleted is 0 here and after deleting 23 # test assumed that e.g. rows_deleted is 0 here and after deleting 23
...@@ -425,11 +427,19 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca ...@@ -425,11 +427,19 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca
select count(*) from t1 where sca_code = 'PD'; select count(*) from t1 where sca_code = 'PD';
select count(*) from t1 where sca_code <= 'PD'; select count(*) from t1 where sca_code <= 'PD';
select count(*) from t1 where sca_pic is null; select count(*) from t1 where sca_pic is null;
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
alter table t1 drop index sca_pic;
alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E'; select count(*) from t1 where cat_code='E';
# this should be fixed by MySQL (see Bug #51451)
--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code); alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null; select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n'; select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null; select sca_pic from t1 where sca_pic is null;
...@@ -1317,7 +1327,7 @@ drop table t1; ...@@ -1317,7 +1327,7 @@ drop table t1;
# Test for testable InnoDB status variables. This test # Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...). # uses previous ones(pages_created, rows_deleted, ...).
--replace_result 511 512 --replace_result 8192 8191
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
...@@ -1375,7 +1385,10 @@ show variables like "innodb_thread_sleep_delay"; ...@@ -1375,7 +1385,10 @@ show variables like "innodb_thread_sleep_delay";
let $default=`select @@storage_engine`; let $default=`select @@storage_engine`;
set storage_engine=INNODB; set storage_engine=INNODB;
# this should be fixed by MySQL (see Bug #51451)
set session old_alter_table=1;
source include/varchar.inc; source include/varchar.inc;
set session old_alter_table=0;
# #
# Some errors/warnings on create # Some errors/warnings on create
...@@ -1700,7 +1713,7 @@ set foreign_key_checks=0; ...@@ -1700,7 +1713,7 @@ set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
# Embedded server doesn't chdir to data directory # Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ '' --replace_result $MYSQLD_DATADIR ./ master-data/ ''
-- error 1025 -- error 1025
rename table t3 to t1; rename table t3 to t1;
set foreign_key_checks=1; set foreign_key_checks=1;
...@@ -1854,15 +1867,16 @@ connect (b,localhost,root,,); ...@@ -1854,15 +1867,16 @@ connect (b,localhost,root,,);
connection a; connection a;
create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
insert into t1(a) values (1),(2),(3); insert into t1(a) values (1),(2),(3);
delimiter |;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
delimiter ;|
commit; commit;
connection b; connection b;
set autocommit = 0; set autocommit = 0;
update t1 set b = 5 where a = 2; update t1 set b = 5 where a = 2;
connection a; connection a;
delimiter |;
create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
delimiter ;|
set autocommit = 0; set autocommit = 0;
connection a;
insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), (11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), (12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
...@@ -1926,9 +1940,6 @@ insert into t2(a) values(8); ...@@ -1926,9 +1940,6 @@ insert into t2(a) values(8);
delete from t2 where a = 3; delete from t2 where a = 3;
update t4 set b = b + 1 where a = 3; update t4 set b = b + 1 where a = 3;
commit; commit;
connection a;
commit;
connection b;
drop trigger t1t; drop trigger t1t;
drop trigger t2t; drop trigger t2t;
drop trigger t3t; drop trigger t3t;
...@@ -2342,7 +2353,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; ...@@ -2342,7 +2353,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
# mysqltest first does replace_regex, then replace_result # mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ --replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory # Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . master-data/ '' --replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error 1025 --error 1025
ALTER TABLE t2 MODIFY a INT NOT NULL; ALTER TABLE t2 MODIFY a INT NOT NULL;
DELETE FROM t1; DELETE FROM t1;
......
...@@ -16,6 +16,7 @@ CREATE TABLE bug38231 (a INT); ...@@ -16,6 +16,7 @@ CREATE TABLE bug38231 (a INT);
-- connect (con1,localhost,root,,) -- connect (con1,localhost,root,,)
-- connect (con2,localhost,root,,) -- connect (con2,localhost,root,,)
-- connect (con3,localhost,root,,)
-- connection con1 -- connection con1
SET autocommit=0; SET autocommit=0;
...@@ -26,15 +27,45 @@ SET autocommit=0; ...@@ -26,15 +27,45 @@ SET autocommit=0;
-- send -- send
LOCK TABLE bug38231 WRITE; LOCK TABLE bug38231 WRITE;
# When con1 does UNLOCK below this will release either con2 or con3 which are
# both waiting on LOCK. At the end we must first --reap and UNLOCK the
# connection that has been released, otherwise it will wait forever. We assume
# that the released connection will be the first one that has gained the LOCK,
# thus we force the order here - con2 does LOCK first, then con3. In other
# words we wait for LOCK from con2 above to be exected before doing LOCK in
# con3.
-- connection con1
let $wait_condition =
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = 'LOCK TABLE bug38231 WRITE';
-- source include/wait_condition.inc
# the above enables query log, re-disable it
-- disable_query_log
-- connection con3
SET autocommit=0;
-- send
LOCK TABLE bug38231 WRITE;
-- connection default -- connection default
-- send -- send
TRUNCATE TABLE bug38231; TRUNCATE TABLE bug38231;
-- connection con1 -- connection con1
# give time to TRUNCATE and others to be executed; without sleep, sometimes # Wait for TRUNCATE and the other two LOCKs to be executed; without this,
# UNLOCK executes before TRUNCATE # sometimes UNLOCK executes before them. We assume there are no other
# TODO: Replace with wait_condition once possible under embedded server. # sessions executing at the same time with the same SQL commands.
-- sleep 0.2 let $wait_condition =
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = 'TRUNCATE TABLE bug38231';
-- source include/wait_condition.inc
let $wait_condition =
SELECT COUNT(*) = 2 FROM information_schema.processlist
WHERE info = 'LOCK TABLE bug38231 WRITE';
-- source include/wait_condition.inc
# the above enables query log, re-disable it
-- disable_query_log
# this crashes the server if the bug is present # this crashes the server if the bug is present
UNLOCK TABLES; UNLOCK TABLES;
...@@ -44,10 +75,16 @@ UNLOCK TABLES; ...@@ -44,10 +75,16 @@ UNLOCK TABLES;
-- reap -- reap
UNLOCK TABLES; UNLOCK TABLES;
-- connection con3
-- reap
UNLOCK TABLES;
-- connection default -- connection default
-- reap -- reap
-- disconnect con1 -- disconnect con1
-- disconnect con2 -- disconnect con2
-- disconnect con3
# test that TRUNCATE works with with row-level locks # test that TRUNCATE works with with row-level locks
......
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Error: table 'test/bug39438'");
--enable_query_log
SET storage_engine=InnoDB; SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server # we care only that the following SQL commands do not crash the server
...@@ -23,7 +19,31 @@ DROP TABLE IF EXISTS bug39438; ...@@ -23,7 +19,31 @@ DROP TABLE IF EXISTS bug39438;
CREATE TABLE bug39438 (id INT) ENGINE=INNODB; CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
ALTER TABLE bug39438 DISCARD TABLESPACE; # remove: XXX Uncomment the following ALTER and remove those lines after
# remove: applying the patch.
# remove: Obviously this test is useless without this ALTER command,
# remove: but it causes warnings to be printed by mysqld and the whole
# remove: mysql-test suite fails at the end (returns non-zero). Please
# remove: apply this patch to the mysql source tree, remove those lines
# remove: and uncomment the following ALTER. We do not care about the
# remove: warnings, this test is to ensure mysqld does not crash.
# remove: === modified file 'mysql-test/lib/mtr_report.pl'
# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000
# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000
# remove: @@ -412,7 +412,10 @@
# remove:
# remove: # When trying to set lower_case_table_names = 2
# remove: # on a case sensitive file system. Bug#37402.
# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
# remove: +
# remove: + # this test is expected to print warnings
# remove: + ($testname eq 'main.innodb_bug39438')
# remove: )
# remove: {
# remove: next; # Skip these lines
# remove:
#ALTER TABLE bug39438 DISCARD TABLESPACE;
# this crashes the server if the bug is present # this crashes the server if the bug is present
SHOW TABLE STATUS; SHOW TABLE STATUS;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=1; set global innodb_commit_concurrency=1;
...@@ -14,7 +14,7 @@ set global innodb_commit_concurrency=42; ...@@ -14,7 +14,7 @@ set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=DEFAULT; set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=1; set global innodb_commit_concurrency=1;
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=1; set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=42; set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
......
# #
# Bug#44571 InnoDB Plugin crashes on ADD INDEX # Bug#44571 InnoDB Plugin crashes on ADD INDEX
# http://bugs.mysql.com/44571 # http://bugs.mysql.com/44571
# Please also refer to related fix in
# http://bugs.mysql.com/47621
# #
-- source include/have_innodb.inc -- source include/have_innodb.inc
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
ALTER TABLE bug44571 CHANGE foo bar INT; 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 -- error ER_KEY_COLUMN_DOES_NOT_EXITS
ALTER TABLE bug44571 ADD INDEX bug44571b (foo); ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
# The following will fail, because the CHANGE foo bar was # The following create indexes should succeed,
# not communicated to InnoDB. # indirectly confirm the CHANGE foo bar is successful.
--error ER_NOT_KEYFILE ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
ALTER TABLE bug44571 ADD INDEX bug44571b (bar); DROP INDEX bug44571c ON bug44571;
--error ER_NOT_KEYFILE CREATE INDEX bug44571c ON bug44571 (bar);
CREATE INDEX bug44571b ON bug44571 (bar);
DROP TABLE bug44571; DROP TABLE bug44571;
#
# Bug#11650: LIKE pattern matching using prefix index
# doesn't return correct result
#
--disable_warnings
#
# This query creates a column using
# character_set_connection and
# collation_connection.
#
create table t1 engine=innodb select repeat('a',50) as c1;
--enable_warnings
alter table t1 add index(c1(5));
insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111');
select collation(c1) from t1 limit 1;
select c1 from t1 where c1 like 'abcdef%' order by c1;
select c1 from t1 where c1 like 'abcde1%' order by c1;
select c1 from t1 where c1 like 'abcde11%' order by c1;
select c1 from t1 where c1 like 'abcde111%' order by c1;
drop table t1;
disable_query_log;
--require r/true.require
select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb';
enable_query_log;
This diff is collapsed.
This diff is collapsed.
drop table if exists t1;
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
create table t2 like t1;
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
begin;
replace into t1 select * from t2;
set session transaction isolation level read committed;
set autocommit=0;
delete from t2 where a=5;
commit;
delete from t2;
commit;
commit;
begin;
insert into t1 select * from t2;
set session transaction isolation level read committed;
set autocommit=0;
delete from t2 where a=5;
commit;
delete from t2;
commit;
commit;
select * from t1;
a
1
2
3
4
5
6
7
drop table t1;
drop table t2;
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
# a consistent read of the source table.
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set session transaction isolation level read committed;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
create table t2 like t1;
insert into t2 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
# REPLACE INTO ... SELECT case
begin;
# this should not result in any locks on t2.
replace into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cause a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
# INSERT INTO ... SELECT case
begin;
# this should not result in any locks on t2.
insert into t1 select * from t2;
connection b;
set session transaction isolation level read committed;
set autocommit=0;
# should not cause a lock wait.
delete from t2 where a=5;
commit;
delete from t2;
commit;
connection a;
commit;
select * from t1;
drop table t1;
drop table t2;
connection default;
disconnect a;
disconnect b;
set global innodb_table_locks=1;
select @@innodb_table_locks;
@@innodb_table_locks
1
drop table if exists t1;
set @@innodb_table_locks=1;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
set autocommit=0;
lock table t1 write;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
commit;
update t1 set x=2 where id = 0;
commit;
unlock tables;
select * from t1;
id x
0 2
commit;
drop table t1;
set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2);
commit;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
set autocommit=0;
set @@innodb_table_locks=0;
lock table t1 write;
update t1 set x=10 where id = 2;
SELECT * from t1 where id = 2;
id x
2 2
UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
id x
0 0
1 1
2 3
commit;
unlock tables;
commit;
select * from t1;
id x
0 0
1 1
2 10
drop table t1;
-- source include/have_innodb.inc
#
# Check and select innodb lock type
#
set global innodb_table_locks=1;
select @@innodb_table_locks;
#
# Testing of explicit table locks with enforced table locks
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Testing of explicit table locks with enforced table locks
#
set @@innodb_table_locks=1;
connection con1;
create table t1 (id integer, x integer) engine=INNODB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
connection con2;
set autocommit=0;
# The following statement should hang because con1 is locking the page
--send
lock table t1 write;
--sleep 2
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
connection con2;
reap;
update t1 set x=2 where id = 0;
commit;
unlock tables;
connection con1;
select * from t1;
commit;
drop table t1;
#
# Try with old lock method (where LOCK TABLE is ignored by InnoDB)
#
set @@innodb_table_locks=0;
create table t1 (id integer primary key, x integer) engine=INNODB;
insert into t1 values(0, 0),(1,1),(2,2);
commit;
SELECT * from t1 where id = 0 FOR UPDATE;
connection con2;
set autocommit=0;
set @@innodb_table_locks=0;
# The following statement should work becase innodb doesn't check table locks
lock table t1 write;
connection con1;
# This will be locked by MySQL
--send
update t1 set x=10 where id = 2;
--sleep 2
connection con2;
# Note that we will get a deadlock if we try to select any rows marked
# for update by con1 !
SELECT * from t1 where id = 2;
UPDATE t1 set x=3 where id = 2;
commit;
SELECT * from t1;
commit;
unlock tables;
connection con1;
reap;
commit;
select * from t1;
drop table t1;
# End of 4.1 tests
--binlog_cache_size=32768 --loose_innodb_lock_wait_timeout=1
drop table if exists t1;
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
select * from t1;
c1 c2 stamp
replace delayed into t1 (c1, c2) values ( "text1","11");
ERROR HY000: DELAYED option not supported for table 't1'
select * from t1;
c1 c2 stamp
replace delayed into t1 (c1, c2) values ( "text1","12");
ERROR HY000: DELAYED option not supported for table 't1'
select * from t1;
c1 c2 stamp
drop table t1;
-- source include/have_innodb.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Bug #1078
#
create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
select * from t1;
--error ER_DELAYED_NOT_SUPPORTED
replace delayed into t1 (c1, c2) values ( "text1","11");
select * from t1;
--error ER_DELAYED_NOT_SUPPORTED
replace delayed into t1 (c1, c2) values ( "text1","12");
select * from t1;
drop table t1;
# End of 4.1 tests
drop table if exists t1;
set binlog_format=mixed;
set session transaction isolation level repeatable read;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
select * from t1 where a=3 lock in share mode;
a
3
set binlog_format=mixed;
set session transaction isolation level repeatable read;
set autocommit=0;
update t1 set a=10 where a=5;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
set session transaction isolation level read committed;
update t1 set a=10 where a=5;
select * from t1 where a=2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t1 where a=2 limit 1 for update;
a
2
update t1 set a=11 where a=6;
update t1 set a=12 where a=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
update t1 set a=13 where a=1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
update t1 set a=14 where a=1;
commit;
select * from t1;
a
14
2
3
4
10
11
7
drop table t1;
create table t1 (a int, b int) engine=myisam;
create table t2 (c int, d int, key (c)) engine=innodb;
insert into t1 values (1,1);
insert into t2 values (1,2);
set session transaction isolation level read committed;
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
drop table t1, t2;
-- source include/not_embedded.inc
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
# basic tests of semi-consistent reads
connect (a,localhost,root,,);
connect (b,localhost,root,,);
connection a;
set binlog_format=mixed;
set session transaction isolation level repeatable read;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
set autocommit=0;
# this should lock the entire table
select * from t1 where a=3 lock in share mode;
connection b;
set binlog_format=mixed;
set session transaction isolation level repeatable read;
set autocommit=0;
-- error ER_LOCK_WAIT_TIMEOUT
update t1 set a=10 where a=5;
connection a;
commit;
connection b;
# perform a semi-consisent read (and unlock non-matching rows)
set session transaction isolation level read committed;
update t1 set a=10 where a=5;
connection a;
-- error ER_LOCK_WAIT_TIMEOUT
select * from t1 where a=2 for update;
# this should lock the records (1),(2)
select * from t1 where a=2 limit 1 for update;
connection b;
# semi-consistent read will skip non-matching locked rows a=1, a=2
update t1 set a=11 where a=6;
-- error ER_LOCK_WAIT_TIMEOUT
update t1 set a=12 where a=2;
-- error ER_LOCK_WAIT_TIMEOUT
update t1 set a=13 where a=1;
connection a;
commit;
connection b;
update t1 set a=14 where a=1;
commit;
connection a;
select * from t1;
drop table t1;
connection default;
disconnect a;
disconnect b;
# Bug 39320
create table t1 (a int, b int) engine=myisam;
create table t2 (c int, d int, key (c)) engine=innodb;
insert into t1 values (1,1);
insert into t2 values (1,2);
connect (a,localhost,root,,);
connection a;
set session transaction isolation level read committed;
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
connection default;
disconnect a;
drop table t1, t2;
This diff is collapsed.
This diff is collapsed.
#
# Bug#21704: Renaming column does not update FK definition.
#
# Test that it's not possible to rename columns participating in a
# foreign key (either in the referencing or referenced table).
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
# Test renaming the column in the referenced table.
ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT;
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table
ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT;
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
# Test with self-referential constraints
ALTER TABLE t3 CHANGE a d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT;
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
# Cleanup.
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
-- source include/have_innodb.inc
--echo #
--echo # Bug#21704: Renaming column does not update FK definition.
--echo #
--echo
--echo # Test that it's not possible to rename columns participating in a
--echo # foreign key (either in the referencing or referenced table).
--echo
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
--enable_warnings
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t2 (a INT PRIMARY KEY, b INT,
CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT,
CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a))
ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3);
--echo
--echo # Test renaming the column in the referenced table.
--echo
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t1 CHANGE a c INT;
--echo # Ensure that online column rename works.
--enable_info
ALTER TABLE t1 CHANGE b c INT;
--disable_info
--echo
--echo # Test renaming the column in the referencing table
--echo
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t2 CHANGE a c INT;
--echo # Ensure that online column rename works.
--enable_info
ALTER TABLE t2 CHANGE b c INT;
--disable_info
--echo
--echo # Test with self-referential constraints
--echo
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t3 CHANGE a d INT;
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_ERROR_ON_RENAME
ALTER TABLE t3 CHANGE b d INT;
--echo # Ensure that online column rename works.
--enable_info
ALTER TABLE t3 CHANGE c d INT;
--disable_info
--echo
--echo # Cleanup.
--echo
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
#
# Make sure http://bugs.mysql.com/34053 remains fixed.
#
-- source include/not_embedded.inc
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we do not really care about what gets printed, we are only
# interested in getting success or failure according to our
# expectations
-- disable_query_log
-- disable_result_log
GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
FLUSH PRIVILEGES;
-- connect (con1,localhost,shane,12345,)
-- connection con1
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
DROP TABLE innodb_monitorx;
CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
DROP TABLE innodb_monito;
CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
DROP TABLE xinnodb_monitor;
CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
DROP TABLE nnodb_monitor;
-- connection default
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
-- connection con1
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE innodb_monitor;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
DROP TABLE innodb_mem_validate;
-- connection default
DROP TABLE innodb_monitor;
DROP TABLE innodb_mem_validate;
DROP USER 'shane'@'localhost';
-- disconnect con1
#
# Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1
# http://bugs.mysql.com/34300
#
-- source include/have_innodb.inc
-- disable_query_log
-- disable_result_log
# set packet size and reconnect
let $max_packet=`select @@global.max_allowed_packet`;
SET @@global.max_allowed_packet=16777216;
--connect (newconn, localhost, root,,)
DROP TABLE IF EXISTS bug34300;
CREATE TABLE bug34300 (
f4 TINYTEXT,
f6 MEDIUMTEXT,
f8 TINYBLOB
) ENGINE=InnoDB;
INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz');
-- enable_result_log
SELECT f4, f8 FROM bug34300;
ALTER TABLE bug34300 ADD COLUMN (f10 INT);
SELECT f4, f8 FROM bug34300;
DROP TABLE bug34300;
EVAL SET @@global.max_allowed_packet=$max_packet;
#
# Bug#35220 ALTER TABLE too picky on reserved word "foreign"
# http://bugs.mysql.com/35220
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not produce errors
-- disable_query_log
-- disable_result_log
CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT);
ALTER TABLE bug35220 DROP foreign_col;
DROP TABLE bug35220;
SET storage_engine=InnoDB;
INSERT INTO bug38231 VALUES (1), (10), (300);
SET autocommit=0;
SELECT * FROM bug38231 FOR UPDATE;
a
1
10
300
TRUNCATE TABLE bug38231;
COMMIT;
DROP TABLE bug38231;
#
# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
# http://bugs.mysql.com/38231
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server
-- disable_query_log
-- disable_result_log
DROP TABLE IF EXISTS bug38231;
CREATE TABLE bug38231 (a INT);
-- connect (con1,localhost,root,,)
-- connect (con2,localhost,root,,)
-- connect (con3,localhost,root,,)
-- connection con1
SET autocommit=0;
LOCK TABLE bug38231 WRITE;
-- connection con2
SET autocommit=0;
-- send
LOCK TABLE bug38231 WRITE;
# When con1 does UNLOCK below this will release either con2 or con3 which are
# both waiting on LOCK. At the end we must first --reap and UNLOCK the
# connection that has been released, otherwise it will wait forever. We assume
# that the released connection will be the first one that has gained the LOCK,
# thus we force the order here - con2 does LOCK first, then con3. In other
# words we wait for LOCK from con2 above to be exected before doing LOCK in
# con3.
-- connection con1
let $wait_condition =
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = 'LOCK TABLE bug38231 WRITE';
-- source include/wait_condition.inc
# the above enables query log, re-disable it
-- disable_query_log
-- connection con3
SET autocommit=0;
-- send
LOCK TABLE bug38231 WRITE;
-- connection default
-- send
TRUNCATE TABLE bug38231;
-- connection con1
# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
# sometimes UNLOCK executes before them. We assume there are no other
# sessions executing at the same time with the same SQL commands.
let $wait_condition =
SELECT COUNT(*) = 1 FROM information_schema.processlist
WHERE info = 'TRUNCATE TABLE bug38231';
-- source include/wait_condition.inc
let $wait_condition =
SELECT COUNT(*) = 2 FROM information_schema.processlist
WHERE info = 'LOCK TABLE bug38231 WRITE';
-- source include/wait_condition.inc
# the above enables query log, re-disable it
-- disable_query_log
# this crashes the server if the bug is present
UNLOCK TABLES;
# clean up
-- connection con2
-- reap
UNLOCK TABLES;
-- connection con3
-- reap
UNLOCK TABLES;
-- connection default
-- reap
-- disconnect con1
-- disconnect con2
-- disconnect con3
# test that TRUNCATE works with with row-level locks
-- enable_query_log
-- enable_result_log
INSERT INTO bug38231 VALUES (1), (10), (300);
-- connect (con4,localhost,root,,)
-- connection con4
SET autocommit=0;
SELECT * FROM bug38231 FOR UPDATE;
-- connection default
TRUNCATE TABLE bug38231;
-- connection con4
COMMIT;
-- connection default
-- disconnect con4
DROP TABLE bug38231;
#
# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
# http://bugs.mysql.com/39438
#
# This test must be run with innodb_file_per_table=1 because the crash
# only occurs if that option is turned on and DISCARD TABLESPACE only
# works with innodb_file_per_table.
#
-- source include/have_innodb.inc
SET storage_engine=InnoDB;
# we care only that the following SQL commands do not crash the server
-- disable_query_log
-- disable_result_log
DROP TABLE IF EXISTS bug39438;
CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
# remove: XXX Uncomment the following ALTER and remove those lines after
# remove: applying the patch.
# remove: Obviously this test is useless without this ALTER command,
# remove: but it causes warnings to be printed by mysqld and the whole
# remove: mysql-test suite fails at the end (returns non-zero). Please
# remove: apply this patch to the mysql source tree, remove those lines
# remove: and uncomment the following ALTER. We do not care about the
# remove: warnings, this test is to ensure mysqld does not crash.
# remove: === modified file 'mysql-test/lib/mtr_report.pl'
# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000
# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000
# remove: @@ -412,7 +412,10 @@
# remove:
# remove: # When trying to set lower_case_table_names = 2
# remove: # on a case sensitive file system. Bug#37402.
# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
# remove: +
# remove: + # this test is expected to print warnings
# remove: + ($testname eq 'main.innodb_bug39438')
# remove: )
# remove: {
# remove: next; # Skip these lines
# remove:
#ALTER TABLE bug39438 DISCARD TABLESPACE;
# this crashes the server if the bug is present
SHOW TABLE STATUS;
DROP TABLE bug39438;
create table bug40565(value decimal(4,2)) engine=innodb;
insert into bug40565 values (1), (null);
update bug40565 set value=NULL;
affected rows: 1
info: Rows matched: 2 Changed: 1 Warnings: 0
update bug40565 set value=NULL;
affected rows: 0
info: Rows matched: 2 Changed: 0 Warnings: 0
drop table bug40565;
# Bug #40565 Update Query Results in "1 Row Affected" But Should Be "Zero Rows"
-- source include/have_innodb.inc
create table bug40565(value decimal(4,2)) engine=innodb;
insert into bug40565 values (1), (null);
--enable_info
update bug40565 set value=NULL;
update bug40565 set value=NULL;
--disable_info
drop table bug40565;
set global innodb_commit_concurrency=0;
ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
42
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
set global innodb_commit_concurrency=0;
ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
#
# Bug#42101 Race condition in innodb_commit_concurrency
# http://bugs.mysql.com/42101
#
-- source include/have_innodb.inc
--error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
--error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
set global innodb_commit_concurrency=1;
ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
set global innodb_commit_concurrency=42;
ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
#
# Bug#42101 Race condition in innodb_commit_concurrency
# http://bugs.mysql.com/42101
#
-- source include/have_innodb.inc
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
--error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency;
--error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
create table bug44369 (DB_ROW_ID int) engine=innodb;
ERROR 42000: Incorrect column name 'DB_ROW_ID'
create table bug44369 (db_row_id int) engine=innodb;
ERROR 42000: Incorrect column name 'db_row_id'
create table bug44369 (db_TRX_Id int) engine=innodb;
ERROR 42000: Incorrect column name 'db_TRX_Id'
# This is the test for bug 44369. We should
# block table creation with columns match
# some innodb internal reserved key words,
# both case sensitively and insensitely.
--source include/have_innodb.inc
# This create table operation should fail.
--error ER_WRONG_COLUMN_NAME
create table bug44369 (DB_ROW_ID int) engine=innodb;
# This create should fail as well
--error ER_WRONG_COLUMN_NAME
create table bug44369 (db_row_id int) engine=innodb;
--error ER_WRONG_COLUMN_NAME
create table bug44369 (db_TRX_Id int) engine=innodb;
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
ALTER TABLE bug44571 CHANGE foo bar INT;
ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
ERROR 42000: Key column 'foo' doesn't exist in table
ALTER TABLE bug44571 ADD INDEX bug44571c (bar);
DROP INDEX bug44571c ON bug44571;
CREATE INDEX bug44571c ON bug44571 (bar);
DROP TABLE bug44571;
#
# 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
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 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;
set session transaction isolation level read committed;
create table bug45357(a int, b int,key(b))engine=innodb;
insert into bug45357 values (25170,6122);
update bug45357 set a=1 where b=30131;
delete from bug45357 where b < 20996;
delete from bug45357 where b < 7001;
drop table bug45357;
-- source include/have_innodb.inc
set session transaction isolation level read committed;
create table bug45357(a int, b int,key(b))engine=innodb;
insert into bug45357 values (25170,6122);
update bug45357 set a=1 where b=30131;
delete from bug45357 where b < 20996;
delete from bug45357 where b < 7001;
drop table bug45357;
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
show warnings;
Level Code Message
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
Error 1005 Can't create table 'test.bug46000' (errno: -1)
create table bug46000(id int) engine=innodb;
create index GEN_CLUST_INDEX on bug46000(id);
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
show warnings;
Level Code Message
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
Error 1030 Got error -1 from storage engine
create index idx on bug46000(id);
drop table bug46000;
# This is the test for bug 46000. We shall
# block any index creation with the name of
# "GEN_CLUST_INDEX", which is the reserved
# name for innodb default primary index.
--source include/have_innodb.inc
# This 'create table' operation should fail because of
# using the reserve name as its index name.
--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
# Mixed upper/lower case of the reserved key words
--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
show warnings;
create table bug46000(id int) engine=innodb;
# This 'create index' operation should fail.
--error ER_WRONG_NAME_FOR_INDEX
create index GEN_CLUST_INDEX on bug46000(id);
show warnings;
# This 'create index' operation should succeed, no
# temp table left from last failed create index
# operation.
create index idx on bug46000(id);
drop table bug46000;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment