mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-28820 MyISAM wrong server status flags
MyISAM tables no longer take transactional metadata locks unless there already is an active transaction.
This commit is contained in:
@ -88,3 +88,47 @@ unlock tables;
|
|||||||
connection default;
|
connection default;
|
||||||
disconnect locker;
|
disconnect locker;
|
||||||
DROP TABLE t1,t3;
|
DROP TABLE t1,t3;
|
||||||
|
#
|
||||||
|
# MDEV-28820 MyISAM wrong server status flags
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
set autocommit=0;
|
||||||
|
select @@in_transaction;
|
||||||
|
@@in_transaction
|
||||||
|
0
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
select @@in_transaction;
|
||||||
|
@@in_transaction
|
||||||
|
0
|
||||||
|
connect foo,localhost,root;
|
||||||
|
drop table t1;
|
||||||
|
connection default;
|
||||||
|
set autocommit=1;
|
||||||
|
create table t1 (a int);
|
||||||
|
create table t2 (b int) engine=innodb;
|
||||||
|
set autocommit=0;
|
||||||
|
select @@in_transaction;
|
||||||
|
@@in_transaction
|
||||||
|
0
|
||||||
|
select * from t2;
|
||||||
|
b
|
||||||
|
select @@in_transaction;
|
||||||
|
@@in_transaction
|
||||||
|
1
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
connection foo;
|
||||||
|
drop table t1;
|
||||||
|
connection default;
|
||||||
|
select * from t1;
|
||||||
|
a
|
||||||
|
commit;
|
||||||
|
connection foo;
|
||||||
|
disconnect foo;
|
||||||
|
connection default;
|
||||||
|
set autocommit=default;
|
||||||
|
drop table t2;
|
||||||
|
#
|
||||||
|
# End of 10.4 tests
|
||||||
|
#
|
||||||
|
@ -80,3 +80,46 @@ connection default;
|
|||||||
disconnect locker;
|
disconnect locker;
|
||||||
DROP TABLE t1,t3;
|
DROP TABLE t1,t3;
|
||||||
--enable_service_connection
|
--enable_service_connection
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-28820 MyISAM wrong server status flags
|
||||||
|
--echo #
|
||||||
|
# MyISAM alone doesn't start a transaction or takes transactional MDL
|
||||||
|
create table t1 (a int);
|
||||||
|
set autocommit=0;
|
||||||
|
select @@in_transaction;
|
||||||
|
select * from t1;
|
||||||
|
select @@in_transaction;
|
||||||
|
connect foo,localhost,root;
|
||||||
|
drop table t1;
|
||||||
|
connection default;
|
||||||
|
set autocommit=1;
|
||||||
|
|
||||||
|
# MyISAM in a transaction (started by InnoDB) takes transactional MDL all right
|
||||||
|
create table t1 (a int);
|
||||||
|
create table t2 (b int) engine=innodb;
|
||||||
|
set autocommit=0;
|
||||||
|
select @@in_transaction;
|
||||||
|
select * from t2;
|
||||||
|
select @@in_transaction;
|
||||||
|
select * from t1;
|
||||||
|
connection foo;
|
||||||
|
send drop table t1;
|
||||||
|
connection default;
|
||||||
|
let $wait_condition=
|
||||||
|
select count(*) > 0 from information_schema.processlist
|
||||||
|
where state = "Waiting for table metadata lock";
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
select * from t1;
|
||||||
|
commit;
|
||||||
|
|
||||||
|
connection foo;
|
||||||
|
reap;
|
||||||
|
disconnect foo;
|
||||||
|
connection default;
|
||||||
|
set autocommit=default;
|
||||||
|
drop table t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.4 tests
|
||||||
|
--echo #
|
||||||
|
@ -126,7 +126,7 @@ test.t1 check error Record-count is not ok; is 2 Should be: 1
|
|||||||
test.t1 check warning Found 2 key parts. Should be: 1
|
test.t1 check warning Found 2 key parts. Should be: 1
|
||||||
test.t1 check error Corrupt
|
test.t1 check error Corrupt
|
||||||
# At this point we have a corrupt t1
|
# At this point we have a corrupt t1
|
||||||
set autocommit = 0;
|
start transaction;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@ -145,7 +145,6 @@ ALTER TABLE t2 ADD val INT;
|
|||||||
connection default;
|
connection default;
|
||||||
# With fix we should have alter table waiting for t2 lock here.
|
# With fix we should have alter table waiting for t2 lock here.
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
SET autocommit = 1;
|
|
||||||
connection con2;
|
connection con2;
|
||||||
connection default;
|
connection default;
|
||||||
disconnect con2;
|
disconnect con2;
|
||||||
|
@ -135,7 +135,7 @@ flush table t1;
|
|||||||
check table t1;
|
check table t1;
|
||||||
|
|
||||||
--echo # At this point we have a corrupt t1
|
--echo # At this point we have a corrupt t1
|
||||||
set autocommit = 0;
|
start transaction;
|
||||||
select * from t2;
|
select * from t2;
|
||||||
--echo # Without fix select from t1 will break the transaction. After the fix
|
--echo # Without fix select from t1 will break the transaction. After the fix
|
||||||
--echo # transaction should be active and should hold lock on table t2. Alter
|
--echo # transaction should be active and should hold lock on table t2. Alter
|
||||||
@ -153,7 +153,6 @@ let $wait_condition=
|
|||||||
LIKE "Waiting%" AND info = "ALTER TABLE t2 ADD val INT";
|
LIKE "Waiting%" AND info = "ALTER TABLE t2 ADD val INT";
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
SET autocommit = 1;
|
|
||||||
|
|
||||||
connection con2;
|
connection con2;
|
||||||
--reap
|
--reap
|
||||||
|
@ -18,14 +18,14 @@ connect con2, localhost, root;
|
|||||||
connection default;
|
connection default;
|
||||||
CREATE SCHEMA schema1;
|
CREATE SCHEMA schema1;
|
||||||
CREATE TABLE schema1.t1 (a INT);
|
CREATE TABLE schema1.t1 (a INT);
|
||||||
SET autocommit= FALSE;
|
START TRANSACTION;
|
||||||
INSERT INTO schema1.t1 VALUES (1);
|
INSERT INTO schema1.t1 VALUES (1);
|
||||||
connection con2;
|
connection con2;
|
||||||
DROP SCHEMA schema1;
|
DROP SCHEMA schema1;
|
||||||
connection default;
|
connection default;
|
||||||
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
|
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
SET autocommit= TRUE;
|
COMMIT;
|
||||||
connection con2;
|
connection con2;
|
||||||
connection default;
|
connection default;
|
||||||
disconnect con2;
|
disconnect con2;
|
||||||
|
@ -25,7 +25,7 @@ connection default;
|
|||||||
CREATE SCHEMA schema1;
|
CREATE SCHEMA schema1;
|
||||||
CREATE TABLE schema1.t1 (a INT);
|
CREATE TABLE schema1.t1 (a INT);
|
||||||
|
|
||||||
SET autocommit= FALSE;
|
START TRANSACTION;
|
||||||
INSERT INTO schema1.t1 VALUES (1);
|
INSERT INTO schema1.t1 VALUES (1);
|
||||||
|
|
||||||
connection con2;
|
connection con2;
|
||||||
@ -40,7 +40,7 @@ let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
|
|||||||
# Listing the error twice to prevent result diffences based on filename.
|
# Listing the error twice to prevent result diffences based on filename.
|
||||||
--error 1,1
|
--error 1,1
|
||||||
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
|
ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
|
||||||
SET autocommit= TRUE;
|
COMMIT;
|
||||||
|
|
||||||
connection con2;
|
connection con2;
|
||||||
--reap
|
--reap
|
||||||
|
@ -463,8 +463,8 @@ drop function f1;
|
|||||||
create function f1() returns varchar(20) return "f1()";
|
create function f1() returns varchar(20) return "f1()";
|
||||||
create function f2() returns varchar(20) return "f2()";
|
create function f2() returns varchar(20) return "f2()";
|
||||||
create view v1 as select f1() as a;
|
create view v1 as select f1() as a;
|
||||||
set @@session.autocommit=0;
|
|
||||||
lock table v1 read;
|
lock table v1 read;
|
||||||
|
start transaction;
|
||||||
select * from v1;
|
select * from v1;
|
||||||
a
|
a
|
||||||
f1()
|
f1()
|
||||||
@ -486,6 +486,7 @@ connection con2;
|
|||||||
# Reaping 'drop function f2'...
|
# Reaping 'drop function f2'...
|
||||||
connection default;
|
connection default;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
|
commit;
|
||||||
connection con1;
|
connection con1;
|
||||||
# Reaping 'drop function f1'...
|
# Reaping 'drop function f1'...
|
||||||
connection default;
|
connection default;
|
||||||
@ -494,7 +495,6 @@ ERROR 42000: FUNCTION test.f1 does not exist
|
|||||||
drop function f2;
|
drop function f2;
|
||||||
ERROR 42000: FUNCTION test.f2 does not exist
|
ERROR 42000: FUNCTION test.f2 does not exist
|
||||||
drop view v1;
|
drop view v1;
|
||||||
set @@session.autocommit=default;
|
|
||||||
#
|
#
|
||||||
# 8) Check the situation when we're preparing or executing a
|
# 8) Check the situation when we're preparing or executing a
|
||||||
# prepared statement, and as part of that try to flush the
|
# prepared statement, and as part of that try to flush the
|
||||||
|
@ -537,8 +537,8 @@ drop function f1;
|
|||||||
create function f1() returns varchar(20) return "f1()";
|
create function f1() returns varchar(20) return "f1()";
|
||||||
create function f2() returns varchar(20) return "f2()";
|
create function f2() returns varchar(20) return "f2()";
|
||||||
create view v1 as select f1() as a;
|
create view v1 as select f1() as a;
|
||||||
set @@session.autocommit=0;
|
|
||||||
lock table v1 read;
|
lock table v1 read;
|
||||||
|
start transaction;
|
||||||
select * from v1;
|
select * from v1;
|
||||||
savepoint sv;
|
savepoint sv;
|
||||||
select f2();
|
select f2();
|
||||||
@ -565,6 +565,7 @@ connection con2;
|
|||||||
reap;
|
reap;
|
||||||
connection default;
|
connection default;
|
||||||
unlock tables;
|
unlock tables;
|
||||||
|
commit;
|
||||||
connection con1;
|
connection con1;
|
||||||
--echo # Reaping 'drop function f1'...
|
--echo # Reaping 'drop function f1'...
|
||||||
reap;
|
reap;
|
||||||
@ -574,7 +575,6 @@ drop function f1;
|
|||||||
--error ER_SP_DOES_NOT_EXIST
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
drop function f2;
|
drop function f2;
|
||||||
drop view v1;
|
drop view v1;
|
||||||
set @@session.autocommit=default;
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # 8) Check the situation when we're preparing or executing a
|
--echo # 8) Check the situation when we're preparing or executing a
|
||||||
|
@ -6319,7 +6319,7 @@ finish:
|
|||||||
thd->release_transactional_locks();
|
thd->release_transactional_locks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (! thd->in_sub_stmt && ! thd->in_multi_stmt_transaction_mode())
|
else if (! thd->in_sub_stmt && ! thd->in_active_multi_stmt_transaction())
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
- If inside a multi-statement transaction,
|
- If inside a multi-statement transaction,
|
||||||
|
Reference in New Issue
Block a user