2017-06-22 17:35:36 +04:00
|
|
|
--source include/have_metadata_lock_info.inc
|
|
|
|
--source include/have_innodb.inc
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-12882 - Assertion `mdl_ticket->m_type == MDL_SHARED_UPGRADABLE ||
|
|
|
|
--echo # mdl_ticket->m_type == MDL_SHARED_NO_WRITE ||
|
|
|
|
--echo # mdl_ticket->m_type == MDL_SHARED_NO_READ_WRITE ||
|
|
|
|
--echo # mdl_ticket->m_type == MDL_SHARED_READ'
|
|
|
|
--echo # failed in MDL_context::upgrade_shared_lock
|
|
|
|
--echo #
|
2022-06-09 10:32:51 +07:00
|
|
|
--disable_service_connection
|
2017-06-22 17:35:36 +04:00
|
|
|
CREATE TABLE t1(a INT) ENGINE=InnoDB;
|
2018-11-06 17:05:24 +02:00
|
|
|
CREATE TABLE t3(a INT) ENGINE=myisam;
|
2017-06-22 17:35:36 +04:00
|
|
|
LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2017-06-22 17:35:36 +04:00
|
|
|
UNLOCK TABLES;
|
|
|
|
LOCK TABLES t1 AS t2 READ, t1 WRITE CONCURRENT;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2017-06-22 17:35:36 +04:00
|
|
|
UNLOCK TABLES;
|
2018-11-06 17:05:24 +02:00
|
|
|
LOCK TABLES t1 WRITE CONCURRENT, t3 WRITE;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2018-11-06 17:05:24 +02:00
|
|
|
UNLOCK TABLES;
|
|
|
|
LOCK TABLES t3 WRITE, t1 WRITE CONCURRENT;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2018-11-06 17:05:24 +02:00
|
|
|
UNLOCK TABLES;
|
|
|
|
LOCK TABLES t1 WRITE, mysql.user WRITE;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2018-11-06 17:05:24 +02:00
|
|
|
UNLOCK TABLES;
|
|
|
|
--error ER_CANT_LOCK_LOG_TABLE
|
|
|
|
LOCK TABLES mysql.general_log WRITE;
|
|
|
|
# The following may work in embedded server
|
|
|
|
--error 0,ER_DBACCESS_DENIED_ERROR
|
|
|
|
LOCK TABLES t1 WRITE,information_schema.tables READ;
|
|
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE t1,t3;
|
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # Check MDL locks taken for different kind of tables by open
|
|
|
|
--echo #
|
|
|
|
|
2023-11-29 17:43:40 +05:30
|
|
|
CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
|
2018-11-06 17:05:24 +02:00
|
|
|
CREATE TABLE t3(a INT) ENGINE=myisam;
|
2020-07-14 16:17:25 +03:00
|
|
|
connect(purge_control,localhost,root,,);
|
|
|
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
2018-11-06 17:05:24 +02:00
|
|
|
connect (locker,localhost,root,,);
|
|
|
|
connection default;
|
|
|
|
|
|
|
|
FLUSH TABLES WITH READ LOCK;
|
|
|
|
connection locker;
|
|
|
|
--send insert into t1 values (1)
|
|
|
|
connection default;
|
|
|
|
# Wait till above update gets blocked on a user lock.
|
|
|
|
let $wait_condition=
|
|
|
|
select count(*) > 0 from information_schema.processlist
|
|
|
|
where state = "Waiting for backup lock";
|
|
|
|
--source include/wait_condition.inc
|
|
|
|
connection default;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2018-11-06 17:05:24 +02:00
|
|
|
unlock tables;
|
|
|
|
connection locker;
|
|
|
|
--reap
|
|
|
|
unlock tables;
|
|
|
|
connection default;
|
|
|
|
|
|
|
|
FLUSH TABLES WITH READ LOCK;
|
|
|
|
connection locker;
|
|
|
|
--send insert into t3 values (2)
|
|
|
|
connection default;
|
|
|
|
# Wait till above update gets blocked on a user lock.
|
|
|
|
let $wait_condition=
|
|
|
|
select count(*) > 0 from information_schema.processlist
|
|
|
|
where state = "Waiting for backup lock";
|
|
|
|
--source include/wait_condition.inc
|
|
|
|
connection default;
|
2022-07-08 18:37:12 +02:00
|
|
|
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
|
|
|
|
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
|
2018-11-06 17:05:24 +02:00
|
|
|
unlock tables;
|
|
|
|
connection locker;
|
|
|
|
--reap
|
|
|
|
unlock tables;
|
2020-07-14 16:17:25 +03:00
|
|
|
disconnect purge_control;
|
2018-11-06 17:05:24 +02:00
|
|
|
connection default;
|
|
|
|
|
|
|
|
disconnect locker;
|
|
|
|
DROP TABLE t1,t3;
|
2022-06-09 10:32:51 +07:00
|
|
|
--enable_service_connection
|
2023-10-16 17:37:16 +02:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # MDEV-28820 MyISAM wrong server status flags
|
|
|
|
--echo #
|
2023-10-27 15:14:42 +02:00
|
|
|
--disable_view_protocol
|
2023-10-16 17:37:16 +02:00
|
|
|
# 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;
|
2023-10-27 15:14:42 +02:00
|
|
|
--enable_view_protocol
|
2023-10-16 17:37:16 +02:00
|
|
|
|
|
|
|
--echo #
|
|
|
|
--echo # End of 10.4 tests
|
|
|
|
--echo #
|