MDEV-32897 main suite test case prints extra row for metadata_lock_info query

- Added the parameter stats_persistent=0 for InnoDB engine.
- Before printing metadata_lock_info query, make sure that
InnoDB does complete purging.

Reviewed by: Marko Mäkelä
parent 47fc64c1
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
# #
# Check backup and FTWRL # Check backup and FTWRL
# #
...@@ -95,7 +97,7 @@ drop table t1; ...@@ -95,7 +97,7 @@ drop table t1;
# #
# BACKUP STAGE performs implicit commits # BACKUP STAGE performs implicit commits
# #
create table t1(a int) engine=InnoDB; create table t1(a int) stats_persistent=0, engine=InnoDB;
begin; begin;
insert into t1 values(1); insert into t1 values(1);
select lock_mode from information_schema.metadata_lock_info; select lock_mode from information_schema.metadata_lock_info;
...@@ -197,8 +199,9 @@ drop table t1; ...@@ -197,8 +199,9 @@ drop table t1;
# CHECK: RO transaction under BACKUP STAGE is a potential deadlock # CHECK: RO transaction under BACKUP STAGE is a potential deadlock
# OTOH we most probably allow them under FTWRL as well # OTOH we most probably allow them under FTWRL as well
# #
CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; CREATE TABLE t1 (col1 INT)stats_persistent=0, ENGINE = InnoDB;
insert into t1 values (1); insert into t1 values (1);
InnoDB 0 transactions not purged
backup stage start; backup stage start;
backup stage block_commit; backup stage block_commit;
begin; begin;
...@@ -526,3 +529,4 @@ FLUSH TABLE t1 WITH READ LOCK; ...@@ -526,3 +529,4 @@ FLUSH TABLE t1 WITH READ LOCK;
ERROR HY000: Can't execute the command as you have a BACKUP STAGE active ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
BACKUP STAGE END; BACKUP STAGE END;
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_metadata_lock_info.inc --source include/have_metadata_lock_info.inc
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--echo # --echo #
--echo # Check backup and FTWRL --echo # Check backup and FTWRL
--echo # --echo #
...@@ -120,7 +123,7 @@ drop table t1; ...@@ -120,7 +123,7 @@ drop table t1;
--echo # BACKUP STAGE performs implicit commits --echo # BACKUP STAGE performs implicit commits
--echo # --echo #
--disable_view_protocol --disable_view_protocol
create table t1(a int) engine=InnoDB; create table t1(a int) stats_persistent=0, engine=InnoDB;
begin; begin;
insert into t1 values(1); insert into t1 values(1);
select lock_mode from information_schema.metadata_lock_info; select lock_mode from information_schema.metadata_lock_info;
...@@ -221,8 +224,9 @@ drop table t1; ...@@ -221,8 +224,9 @@ drop table t1;
--echo # OTOH we most probably allow them under FTWRL as well --echo # OTOH we most probably allow them under FTWRL as well
--echo # --echo #
--disable_view_protocol --disable_view_protocol
CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; CREATE TABLE t1 (col1 INT)stats_persistent=0, ENGINE = InnoDB;
insert into t1 values (1); insert into t1 values (1);
--source ../suite/innodb/include/wait_all_purged.inc
backup stage start; backup stage start;
backup stage block_commit; backup stage block_commit;
begin; begin;
...@@ -521,3 +525,4 @@ FLUSH TABLE t1 FOR EXPORT; ...@@ -521,3 +525,4 @@ FLUSH TABLE t1 FOR EXPORT;
FLUSH TABLE t1 WITH READ LOCK; FLUSH TABLE t1 WITH READ LOCK;
BACKUP STAGE END; BACKUP STAGE END;
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# #
# Testing which locks we get from all stages # Testing which locks we get from all stages
# #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
InnoDB 0 transactions not purged
BACKUP STAGE START; BACKUP STAGE START;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
...@@ -29,7 +32,8 @@ connection default; ...@@ -29,7 +32,8 @@ connection default;
# #
# testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
# #
create table t1 (a int) engine=innodb; create table t1 (a int) stats_persistent= 0, engine=innodb;
InnoDB 0 transactions not purged
start transaction; start transaction;
insert into t1 values (1); insert into t1 values (1);
connection con1; connection con1;
...@@ -95,7 +99,8 @@ drop table t1; ...@@ -95,7 +99,8 @@ drop table t1;
# #
# testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
# #
create table t1 (a int) engine=innodb; create table t1 (a int)stats_persistent=0, engine=innodb;
InnoDB 0 transactions not purged
start transaction; start transaction;
insert into t1 values (1); insert into t1 values (1);
connection con1; connection con1;
...@@ -122,6 +127,7 @@ connection default; ...@@ -122,6 +127,7 @@ connection default;
# Check if backup stage block_dll + concurrent drop table blocks select # Check if backup stage block_dll + concurrent drop table blocks select
# #
create table t1 (a int) engine=innodb; create table t1 (a int) engine=innodb;
InnoDB 0 transactions not purged
backup stage start; backup stage start;
backup stage block_ddl; backup stage block_ddl;
connection con1; connection con1;
...@@ -217,3 +223,4 @@ DROP TABLE t_permanent_myisam, t_permanent_innodb; ...@@ -217,3 +223,4 @@ DROP TABLE t_permanent_myisam, t_permanent_innodb;
DROP TABLE t_con1_innodb, t_con1_myisam; DROP TABLE t_con1_innodb, t_con1_myisam;
disconnect con1; disconnect con1;
set global lock_wait_timeout=default; set global lock_wait_timeout=default;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
--echo # Testing which locks we get from all stages --echo # Testing which locks we get from all stages
--echo # --echo #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--source ../suite/innodb/include/wait_all_purged.inc
BACKUP STAGE START; BACKUP STAGE START;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
BACKUP STAGE FLUSH; BACKUP STAGE FLUSH;
...@@ -36,8 +39,8 @@ connection default; ...@@ -36,8 +39,8 @@ connection default;
--echo # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE --echo # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
--echo # --echo #
create table t1 (a int) engine=innodb; create table t1 (a int) stats_persistent= 0, engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
start transaction; start transaction;
# Acquires MDL lock # Acquires MDL lock
insert into t1 values (1); insert into t1 values (1);
...@@ -123,7 +126,8 @@ drop table t1; ...@@ -123,7 +126,8 @@ drop table t1;
--echo # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE --echo # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
--echo # --echo #
create table t1 (a int) engine=innodb; create table t1 (a int)stats_persistent=0, engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
start transaction; start transaction;
# Acquires MDL lock # Acquires MDL lock
insert into t1 values (1); insert into t1 values (1);
...@@ -159,6 +163,7 @@ connection default; ...@@ -159,6 +163,7 @@ connection default;
--echo # --echo #
create table t1 (a int) engine=innodb; create table t1 (a int) engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
backup stage start; backup stage start;
backup stage block_ddl; backup stage block_ddl;
connection con1; connection con1;
...@@ -284,3 +289,4 @@ DROP TABLE t_permanent_myisam, t_permanent_innodb; ...@@ -284,3 +289,4 @@ DROP TABLE t_permanent_myisam, t_permanent_innodb;
DROP TABLE t_con1_innodb, t_con1_myisam; DROP TABLE t_con1_innodb, t_con1_myisam;
--disconnect con1 --disconnect con1
set global lock_wait_timeout=default; set global lock_wait_timeout=default;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# #
# Test lock taken # Test lock taken
# #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
InnoDB 0 transactions not purged
BACKUP LOCK test.t1; BACKUP LOCK test.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
...@@ -23,7 +26,7 @@ BACKUP UNLOCK; ...@@ -23,7 +26,7 @@ BACKUP UNLOCK;
# #
connect con1,localhost,root,,; connect con1,localhost,root,,;
connection default; connection default;
create table t1 (a int) engine=innodb; create table t1 (a int) stats_persistent=0,engine=innodb;
insert into t1 values (1); insert into t1 values (1);
backup lock t1; backup lock t1;
select * from t1; select * from t1;
...@@ -32,6 +35,7 @@ a ...@@ -32,6 +35,7 @@ a
connection con1; connection con1;
drop table t1; drop table t1;
connection default; connection default;
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock test t1 MDL_SHARED_HIGH_PRIO Table metadata lock test t1
...@@ -93,6 +97,7 @@ BACKUP LOCK t1; ...@@ -93,6 +97,7 @@ BACKUP LOCK t1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
UNLOCK TABLES; UNLOCK TABLES;
INSERT INTO t1 VALUES(0); INSERT INTO t1 VALUES(0);
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# restart # restart
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
--echo # --echo #
--echo # Test lock taken --echo # Test lock taken
--echo # --echo #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--source ../suite/innodb/include/wait_all_purged.inc
BACKUP LOCK test.t1; BACKUP LOCK test.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
BACKUP UNLOCK; BACKUP UNLOCK;
...@@ -29,7 +31,7 @@ BACKUP UNLOCK; ...@@ -29,7 +31,7 @@ BACKUP UNLOCK;
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
connection default; connection default;
create table t1 (a int) engine=innodb; create table t1 (a int) stats_persistent=0,engine=innodb;
insert into t1 values (1); insert into t1 values (1);
backup lock t1; backup lock t1;
select * from t1; select * from t1;
...@@ -40,6 +42,7 @@ let $wait_condition= ...@@ -40,6 +42,7 @@ let $wait_condition=
select count(*) = 1 from information_schema.processlist select count(*) = 1 from information_schema.processlist
where state = "Waiting for table metadata lock"; where state = "Waiting for table metadata lock";
--source include/wait_condition.inc --source include/wait_condition.inc
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK
select * from t1; select * from t1;
...@@ -107,6 +110,7 @@ LOCK TABLES t2 AS a2 WRITE; ...@@ -107,6 +110,7 @@ LOCK TABLES t2 AS a2 WRITE;
BACKUP LOCK t1; BACKUP LOCK t1;
UNLOCK TABLES; UNLOCK TABLES;
INSERT INTO t1 VALUES(0); INSERT INTO t1 VALUES(0);
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
...@@ -187,7 +191,6 @@ LOCK TABLES t3 AS a2 WRITE, t3 AS a1 READ LOCAL; ...@@ -187,7 +191,6 @@ LOCK TABLES t3 AS a2 WRITE, t3 AS a1 READ LOCAL;
DROP TABLE t3; DROP TABLE t3;
BACKUP UNLOCK; BACKUP UNLOCK;
DROP TABLE t3; DROP TABLE t3;
--echo # --echo #
--echo # MDEV-28367: BACKUP LOCKS on table to be accessible to those --echo # MDEV-28367: BACKUP LOCKS on table to be accessible to those
--echo # with database LOCK TABLES privileges --echo # with database LOCK TABLES privileges
...@@ -260,7 +263,6 @@ disconnect con1; ...@@ -260,7 +263,6 @@ disconnect con1;
drop database db1; drop database db1;
drop user user1@localhost; drop user user1@localhost;
--echo # --echo #
--echo # End of MariaDB 10.4 tests --echo # End of MariaDB 10.4 tests
--echo # --echo #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Multi-threaded tests # Multi-threaded tests
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
...@@ -17,6 +19,7 @@ FROM information_schema.processlist WHERE id = @con1_id; ...@@ -17,6 +19,7 @@ FROM information_schema.processlist WHERE id = @con1_id;
ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY
<con1_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START <con1_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START
BACKUP STAGE END; BACKUP STAGE END;
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_BACKUP_START Backup lock MDL_BACKUP_START Backup lock
...@@ -333,3 +336,4 @@ disconnect con11; ...@@ -333,3 +336,4 @@ disconnect con11;
disconnect con12; disconnect con12;
disconnect backup; disconnect backup;
connection default; connection default;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
# Save the initial number of concurrent sessions. # Save the initial number of concurrent sessions.
--source include/count_sessions.inc --source include/count_sessions.inc
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
let $old_lock_wait_timeout = `SELECT @@global.lock_wait_timeout`; let $old_lock_wait_timeout = `SELECT @@global.lock_wait_timeout`;
--echo #----------------------------------------------------------------------- --echo #-----------------------------------------------------------------------
...@@ -50,6 +52,7 @@ FROM information_schema.processlist WHERE id = @con1_id; ...@@ -50,6 +52,7 @@ FROM information_schema.processlist WHERE id = @con1_id;
# con1 uses @@global.lock_wait_timeout # con1 uses @@global.lock_wait_timeout
BACKUP STAGE END; BACKUP STAGE END;
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
--connection con1 --connection con1
...@@ -383,3 +386,4 @@ SET GLOBAL lock_wait_timeout = $old_lock_wait_timeout; ...@@ -383,3 +386,4 @@ SET GLOBAL lock_wait_timeout = $old_lock_wait_timeout;
--connection default --connection default
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t2 (a int); CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES(1),(2),(3); INSERT INTO t2 VALUES(1),(2),(3);
# #
...@@ -260,6 +262,7 @@ Note 1051 Unknown table 'mysqltest2.t2' ...@@ -260,6 +262,7 @@ Note 1051 Unknown table 'mysqltest2.t2'
create table test.t1 (i int) engine=myisam; create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1; create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
InnoDB 0 transactions not purged
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock # MDL_BACKUP_DDL NULL Backup lock
...@@ -576,6 +579,7 @@ CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t); ...@@ -576,6 +579,7 @@ CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t);
CREATE OR REPLACE TABLE t LIKE tm; CREATE OR REPLACE TABLE t LIKE tm;
ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data
DROP TABLE IF EXISTS tm, t; DROP TABLE IF EXISTS tm, t;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# #
# End of 10.3 tests # End of 10.3 tests
# #
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
--enable_warnings --enable_warnings
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
# #
# Create help table # Create help table
# #
...@@ -216,6 +218,7 @@ drop table if exists test.t1,mysqltest2.t2; ...@@ -216,6 +218,7 @@ drop table if exists test.t1,mysqltest2.t2;
create table test.t1 (i int) engine=myisam; create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1; create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write; lock table test.t1 write, mysqltest2.t2 write;
--source ../suite/innodb/include/wait_all_purged.inc
--replace_column 1 # --replace_column 1 #
--sorted_result --sorted_result
select * from information_schema.metadata_lock_info; select * from information_schema.metadata_lock_info;
...@@ -523,6 +526,7 @@ CREATE OR REPLACE TABLE t LIKE tm; ...@@ -523,6 +526,7 @@ CREATE OR REPLACE TABLE t LIKE tm;
# Cleanup # Cleanup
DROP TABLE IF EXISTS tm, t; DROP TABLE IF EXISTS tm, t;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #
......
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
# mdl_ticket->m_type == MDL_SHARED_READ' # mdl_ticket->m_type == MDL_SHARED_READ'
# failed in MDL_context::upgrade_shared_lock # failed in MDL_context::upgrade_shared_lock
# #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
CREATE TABLE t1(a INT) ENGINE=InnoDB; CREATE TABLE t1(a INT) ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam; CREATE TABLE t3(a INT) ENGINE=myisam;
InnoDB 0 transactions not purged
LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ; LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
...@@ -56,7 +59,7 @@ DROP TABLE t1,t3; ...@@ -56,7 +59,7 @@ DROP TABLE t1,t3;
# #
# Check MDL locks taken for different kind of tables by open # Check MDL locks taken for different kind of tables by open
# #
CREATE TABLE t1(a INT) ENGINE=InnoDB; CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam; CREATE TABLE t3(a INT) ENGINE=myisam;
connect locker,localhost,root,,; connect locker,localhost,root,,;
connection default; connection default;
...@@ -64,6 +67,7 @@ FLUSH TABLES WITH READ LOCK; ...@@ -64,6 +67,7 @@ FLUSH TABLES WITH READ LOCK;
connection locker; connection locker;
insert into t1 values (1); insert into t1 values (1);
connection default; connection default;
InnoDB 0 transactions not purged
connection default; connection default;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
...@@ -77,6 +81,7 @@ FLUSH TABLES WITH READ LOCK; ...@@ -77,6 +81,7 @@ FLUSH TABLES WITH READ LOCK;
connection locker; connection locker;
insert into t3 values (2); insert into t3 values (2);
connection default; connection default;
InnoDB 0 transactions not purged
connection default; connection default;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
...@@ -129,6 +134,7 @@ disconnect foo; ...@@ -129,6 +134,7 @@ disconnect foo;
connection default; connection default;
set autocommit=default; set autocommit=default;
drop table t2; drop table t2;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# #
# End of 10.4 tests # End of 10.4 tests
# #
...@@ -8,9 +8,12 @@ ...@@ -8,9 +8,12 @@
--echo # mdl_ticket->m_type == MDL_SHARED_READ' --echo # mdl_ticket->m_type == MDL_SHARED_READ'
--echo # failed in MDL_context::upgrade_shared_lock --echo # failed in MDL_context::upgrade_shared_lock
--echo # --echo #
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
--disable_service_connection --disable_service_connection
CREATE TABLE t1(a INT) ENGINE=InnoDB; CREATE TABLE t1(a INT) ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam; CREATE TABLE t3(a INT) ENGINE=myisam;
--source ../suite/innodb/include/wait_all_purged.inc
LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ; LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
UNLOCK TABLES; UNLOCK TABLES;
...@@ -38,7 +41,7 @@ DROP TABLE t1,t3; ...@@ -38,7 +41,7 @@ DROP TABLE t1,t3;
--echo # Check MDL locks taken for different kind of tables by open --echo # Check MDL locks taken for different kind of tables by open
--echo # --echo #
CREATE TABLE t1(a INT) ENGINE=InnoDB; CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam; CREATE TABLE t3(a INT) ENGINE=myisam;
connect (locker,localhost,root,,); connect (locker,localhost,root,,);
connection default; connection default;
...@@ -52,6 +55,7 @@ let $wait_condition= ...@@ -52,6 +55,7 @@ let $wait_condition=
select count(*) > 0 from information_schema.processlist select count(*) > 0 from information_schema.processlist
where state = "Waiting for backup lock"; where state = "Waiting for backup lock";
--source include/wait_condition.inc --source include/wait_condition.inc
--source ../suite/innodb/include/wait_all_purged.inc
connection default; connection default;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
unlock tables; unlock tables;
...@@ -69,6 +73,7 @@ let $wait_condition= ...@@ -69,6 +73,7 @@ let $wait_condition=
select count(*) > 0 from information_schema.processlist select count(*) > 0 from information_schema.processlist
where state = "Waiting for backup lock"; where state = "Waiting for backup lock";
--source include/wait_condition.inc --source include/wait_condition.inc
--source ../suite/innodb/include/wait_all_purged.inc
connection default; connection default;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
unlock tables; unlock tables;
...@@ -121,7 +126,7 @@ connection default; ...@@ -121,7 +126,7 @@ connection default;
set autocommit=default; set autocommit=default;
drop table t2; drop table t2;
--enable_view_protocol --enable_view_protocol
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
connect con1,localhost,root,,test,,; connect con1,localhost,root,,test,,;
connect con2,localhost,root,,test,,; connect con2,localhost,root,,test,,;
connect con3,localhost,root,,test,,; connect con3,localhost,root,,test,,;
...@@ -2514,6 +2516,7 @@ connection con2; ...@@ -2514,6 +2516,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL # Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue # and let DROP PROCEDURE continue
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_BACKUP_DDL Backup lock MDL_BACKUP_DDL Backup lock
...@@ -2538,7 +2541,7 @@ SET DEBUG_SYNC= 'RESET'; ...@@ -2538,7 +2541,7 @@ SET DEBUG_SYNC= 'RESET';
# UPDATE should wait for FTWRL with non transactional table second # UPDATE should wait for FTWRL with non transactional table second
# #
create table t1 (a int) engine=myisam; create table t1 (a int) engine=myisam;
create table t2 (a int) engine=innodb; create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1); insert into t1 values (1);
insert into t2 values (1); insert into t2 values (1);
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
...@@ -3124,3 +3127,4 @@ connection default; ...@@ -3124,3 +3127,4 @@ connection default;
SET debug_sync='RESET'; SET debug_sync='RESET';
DROP TABLE t1; DROP TABLE t1;
disconnect con1; disconnect con1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
--enable_warnings --enable_warnings
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
# #
# Test the case of when a exclusive lock request waits for a # Test the case of when a exclusive lock request waits for a
# shared lock being upgraded to a exclusive lock. # shared lock being upgraded to a exclusive lock.
...@@ -3249,6 +3251,7 @@ connection con2; ...@@ -3249,6 +3251,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
--echo # Check that FLUSH must wait to get the GRL --echo # Check that FLUSH must wait to get the GRL
--echo # and let DROP PROCEDURE continue --echo # and let DROP PROCEDURE continue
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
--send FLUSH TABLES WITH READ LOCK --send FLUSH TABLES WITH READ LOCK
...@@ -3274,7 +3277,7 @@ SET DEBUG_SYNC= 'RESET'; ...@@ -3274,7 +3277,7 @@ SET DEBUG_SYNC= 'RESET';
--echo # --echo #
create table t1 (a int) engine=myisam; create table t1 (a int) engine=myisam;
create table t2 (a int) engine=innodb; create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1); insert into t1 values (1);
insert into t2 values (1); insert into t2 values (1);
...@@ -4175,3 +4178,4 @@ disconnect con1; ...@@ -4175,3 +4178,4 @@ disconnect con1;
# Check that all connections opened by test cases in this file are really # Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence. # gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
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