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