mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
Disable parts of the innodb-index test that are not prepared for the
metadata locks that were added at the MySQL level as part of the fix for Bug#45225 Locking: hang if drop table with no timeout
This commit is contained in:
parent
b2576b9e73
commit
4a583ca95c
2 changed files with 93 additions and 158 deletions
|
@ -835,48 +835,6 @@ test.t1 check status OK
|
||||||
explain select * from t1 where b like 'adfd%';
|
explain select * from t1 where b like 'adfd%';
|
||||||
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 ALL b NULL NULL NULL 15 Using where
|
1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
|
||||||
create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
|
|
||||||
insert into t2 select a,left(b,255) from t1;
|
|
||||||
drop table t1;
|
|
||||||
rename table t2 to t1;
|
|
||||||
set innodb_lock_wait_timeout=1;
|
|
||||||
begin;
|
|
||||||
select a from t1 limit 1 for update;
|
|
||||||
a
|
|
||||||
22
|
|
||||||
set innodb_lock_wait_timeout=1;
|
|
||||||
create index t1ba on t1 (b,a);
|
|
||||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
||||||
commit;
|
|
||||||
begin;
|
|
||||||
select a from t1 limit 1 lock in share mode;
|
|
||||||
a
|
|
||||||
22
|
|
||||||
create index t1ba on t1 (b,a);
|
|
||||||
drop index t1ba on t1;
|
|
||||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
||||||
commit;
|
|
||||||
explain select a from t1 order by b;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t1 index NULL t1ba 261 NULL 15 Using index
|
|
||||||
select a,sleep(2+a/100) from t1 order by b limit 3;
|
|
||||||
select sleep(1);
|
|
||||||
sleep(1)
|
|
||||||
0
|
|
||||||
drop index t1ba on t1;
|
|
||||||
a sleep(2+a/100)
|
|
||||||
22 0
|
|
||||||
44 0
|
|
||||||
66 0
|
|
||||||
explain select a from t1 order by b;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t1 index NULL PRIMARY 261 NULL 15 Using index; Using filesort
|
|
||||||
select a from t1 order by b limit 3;
|
|
||||||
a
|
|
||||||
22
|
|
||||||
66
|
|
||||||
44
|
|
||||||
commit;
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set global innodb_file_per_table=on;
|
set global innodb_file_per_table=on;
|
||||||
set global innodb_file_format='Barracuda';
|
set global innodb_file_format='Barracuda';
|
||||||
|
@ -1127,39 +1085,3 @@ t2 CREATE TABLE `t2` (
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
|
|
||||||
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
|
|
||||||
BEGIN;
|
|
||||||
SELECT * FROM t1;
|
|
||||||
a b
|
|
||||||
3 a
|
|
||||||
3 b
|
|
||||||
1 c
|
|
||||||
0 d
|
|
||||||
1 e
|
|
||||||
CREATE INDEX t1a ON t1(a);
|
|
||||||
SELECT * FROM t1;
|
|
||||||
a b
|
|
||||||
3 a
|
|
||||||
3 b
|
|
||||||
1 c
|
|
||||||
0 d
|
|
||||||
1 e
|
|
||||||
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
|
|
||||||
ERROR HY000: Table definition has changed, please retry transaction
|
|
||||||
SELECT * FROM t1;
|
|
||||||
a b
|
|
||||||
3 a
|
|
||||||
3 b
|
|
||||||
1 c
|
|
||||||
0 d
|
|
||||||
1 e
|
|
||||||
COMMIT;
|
|
||||||
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
|
|
||||||
a b
|
|
||||||
0 d
|
|
||||||
1 c
|
|
||||||
1 e
|
|
||||||
3 a
|
|
||||||
3 b
|
|
||||||
DROP TABLE t1;
|
|
||||||
|
|
|
@ -288,66 +288,73 @@ show create table t1;
|
||||||
check table t1;
|
check table t1;
|
||||||
explain select * from t1 where b like 'adfd%';
|
explain select * from t1 where b like 'adfd%';
|
||||||
|
|
||||||
|
# The following tests are disabled because of the introduced timeouts for
|
||||||
|
# metadata locks at the MySQL level as part of the fix for
|
||||||
|
# Bug#45225 Locking: hang if drop table with no timeout
|
||||||
|
# The following commands now play with MySQL metadata locks instead of
|
||||||
|
# InnoDB locks
|
||||||
|
# start disabled45225_1
|
||||||
|
##
|
||||||
|
## Test locking
|
||||||
|
##
|
||||||
#
|
#
|
||||||
# Test locking
|
#create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
|
||||||
|
#insert into t2 select a,left(b,255) from t1;
|
||||||
|
#drop table t1;
|
||||||
|
#rename table t2 to t1;
|
||||||
#
|
#
|
||||||
|
#connect (a,localhost,root,,);
|
||||||
create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
|
#connect (b,localhost,root,,);
|
||||||
insert into t2 select a,left(b,255) from t1;
|
#connection a;
|
||||||
drop table t1;
|
#set innodb_lock_wait_timeout=1;
|
||||||
rename table t2 to t1;
|
#begin;
|
||||||
|
## Obtain an IX lock on the table
|
||||||
connect (a,localhost,root,,);
|
#select a from t1 limit 1 for update;
|
||||||
connect (b,localhost,root,,);
|
#connection b;
|
||||||
connection a;
|
#set innodb_lock_wait_timeout=1;
|
||||||
set innodb_lock_wait_timeout=1;
|
## This would require an S lock on the table, conflicting with the IX lock.
|
||||||
begin;
|
#--error ER_LOCK_WAIT_TIMEOUT
|
||||||
# Obtain an IX lock on the table
|
#create index t1ba on t1 (b,a);
|
||||||
select a from t1 limit 1 for update;
|
#connection a;
|
||||||
connection b;
|
#commit;
|
||||||
set innodb_lock_wait_timeout=1;
|
#begin;
|
||||||
# This would require an S lock on the table, conflicting with the IX lock.
|
## Obtain an IS lock on the table
|
||||||
--error ER_LOCK_WAIT_TIMEOUT
|
#select a from t1 limit 1 lock in share mode;
|
||||||
create index t1ba on t1 (b,a);
|
#connection b;
|
||||||
connection a;
|
## This will require an S lock on the table. No conflict with the IS lock.
|
||||||
commit;
|
#create index t1ba on t1 (b,a);
|
||||||
begin;
|
## This would require an X lock on the table, conflicting with the IS lock.
|
||||||
# Obtain an IS lock on the table
|
#--error ER_LOCK_WAIT_TIMEOUT
|
||||||
select a from t1 limit 1 lock in share mode;
|
#drop index t1ba on t1;
|
||||||
connection b;
|
#connection a;
|
||||||
# This will require an S lock on the table. No conflict with the IS lock.
|
#commit;
|
||||||
create index t1ba on t1 (b,a);
|
#explain select a from t1 order by b;
|
||||||
# This would require an X lock on the table, conflicting with the IS lock.
|
#--send
|
||||||
--error ER_LOCK_WAIT_TIMEOUT
|
#select a,sleep(2+a/100) from t1 order by b limit 3;
|
||||||
drop index t1ba on t1;
|
#
|
||||||
connection a;
|
## The following DROP INDEX will succeed, altough the SELECT above has
|
||||||
commit;
|
## opened a read view. However, during the execution of the SELECT,
|
||||||
explain select a from t1 order by b;
|
## MySQL should hold a table lock that should block the execution
|
||||||
--send
|
## of the DROP INDEX below.
|
||||||
select a,sleep(2+a/100) from t1 order by b limit 3;
|
#
|
||||||
|
#connection b;
|
||||||
# The following DROP INDEX will succeed, altough the SELECT above has
|
#select sleep(1);
|
||||||
# opened a read view. However, during the execution of the SELECT,
|
#drop index t1ba on t1;
|
||||||
# MySQL should hold a table lock that should block the execution
|
#
|
||||||
# of the DROP INDEX below.
|
## After the index was dropped, subsequent SELECTs will use the same
|
||||||
|
## read view, but they should not be accessing the dropped index any more.
|
||||||
connection b;
|
#
|
||||||
select sleep(1);
|
#connection a;
|
||||||
drop index t1ba on t1;
|
#reap;
|
||||||
|
#explain select a from t1 order by b;
|
||||||
# After the index was dropped, subsequent SELECTs will use the same
|
#select a from t1 order by b limit 3;
|
||||||
# read view, but they should not be accessing the dropped index any more.
|
#commit;
|
||||||
|
#
|
||||||
connection a;
|
#connection default;
|
||||||
reap;
|
#disconnect a;
|
||||||
explain select a from t1 order by b;
|
#disconnect b;
|
||||||
select a from t1 order by b limit 3;
|
#
|
||||||
commit;
|
# end disabled45225_1
|
||||||
|
|
||||||
connection default;
|
|
||||||
disconnect a;
|
|
||||||
disconnect b;
|
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
let $per_table=`select @@innodb_file_per_table`;
|
let $per_table=`select @@innodb_file_per_table`;
|
||||||
|
@ -509,28 +516,34 @@ SHOW CREATE TABLE t2;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
connect (a,localhost,root,,);
|
# The following tests are disabled because of the introduced timeouts for
|
||||||
connect (b,localhost,root,,);
|
# metadata locks at the MySQL level as part of the fix for
|
||||||
connection a;
|
# Bug#45225 Locking: hang if drop table with no timeout
|
||||||
CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
|
# The following CREATE INDEX t1a ON t1(a); causes a lock wait timeout
|
||||||
INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
|
# start disabled45225_2
|
||||||
connection b;
|
#connect (a,localhost,root,,);
|
||||||
BEGIN;
|
#connect (b,localhost,root,,);
|
||||||
SELECT * FROM t1;
|
#connection a;
|
||||||
connection a;
|
#CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
|
||||||
CREATE INDEX t1a ON t1(a);
|
#INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
|
||||||
connection b;
|
#connection b;
|
||||||
SELECT * FROM t1;
|
#BEGIN;
|
||||||
--error ER_TABLE_DEF_CHANGED
|
#SELECT * FROM t1;
|
||||||
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
|
#connection a;
|
||||||
SELECT * FROM t1;
|
#CREATE INDEX t1a ON t1(a);
|
||||||
COMMIT;
|
#connection b;
|
||||||
SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
|
#SELECT * FROM t1;
|
||||||
connection default;
|
#--error ER_TABLE_DEF_CHANGED
|
||||||
disconnect a;
|
#SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
|
||||||
disconnect b;
|
#SELECT * FROM t1;
|
||||||
|
#COMMIT;
|
||||||
DROP TABLE t1;
|
#SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
|
||||||
|
#connection default;
|
||||||
|
#disconnect a;
|
||||||
|
#disconnect b;
|
||||||
|
#
|
||||||
|
#DROP TABLE t1;
|
||||||
|
# end disabled45225_2
|
||||||
|
|
||||||
#
|
#
|
||||||
# restore environment to the state it was before this test execution
|
# restore environment to the state it was before this test execution
|
||||||
|
|
Loading…
Add table
Reference in a new issue