Skip to content

Commit 05813f5

Browse files
committed
MDEV-36648 - main.mdl_sync extra test.t2 row in I_S.metadata_lock_info
SELECT FROM information_schema.metadata_lock_info may sporadically return MDL_SHARED lock acquired by InnoDB purge thread. Fix proposed in a7bf0a4 wasn't enough to solve this problem: apparently it did protect against purging old rows, but not against locking the table. Reverted a7bf0a4 in favour of solution proposed in e996f77. That is use wait_all_purged.inc to make sure purge is completed.
1 parent 5f69e18 commit 05813f5

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

mysql-test/main/mdl_sync.result

+1-4
Original file line numberDiff line numberDiff line change
@@ -2431,9 +2431,6 @@ create table t1 (a int) engine=myisam;
24312431
create table t2 (a int) stats_persistent=0, engine=innodb;
24322432
insert into t1 values (1);
24332433
insert into t2 values (1);
2434-
connect con1, localhost, root;
2435-
start transaction with consistent snapshot;
2436-
connection default;
24372434
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
24382435
update t1,t2 set t1.a=2,t2.a=3;
24392436
connection con2;
@@ -2456,6 +2453,7 @@ SET DEBUG_SYNC= 'now SIGNAL grlwait';
24562453
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
24572454
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
24582455
FLUSH TABLES WITH READ LOCK;
2456+
InnoDB 0 transactions not purged
24592457
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
24602458
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
24612459
MDL_BACKUP_FTWRL2 Backup lock
@@ -2465,7 +2463,6 @@ connection default;
24652463
SET DEBUG_SYNC= 'RESET';
24662464
drop table t1,t2;
24672465
disconnect con2;
2468-
disconnect con1;
24692466
#
24702467
# Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'
24712468
# failed in open_ltable()

mysql-test/main/mdl_sync.test

+1-7
Original file line numberDiff line numberDiff line change
@@ -3115,12 +3115,6 @@ create table t2 (a int) stats_persistent=0, engine=innodb;
31153115
insert into t1 values (1);
31163116
insert into t2 values (1);
31173117

3118-
connect (con1, localhost, root);
3119-
# disable innodb purge thread, otherwise it might start purging t2,
3120-
# and will take an mdl, affecting metadata_lock_info output.
3121-
start transaction with consistent snapshot;
3122-
connection default;
3123-
31243118
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';
31253119
--send update t1,t2 set t1.a=2,t2.a=3
31263120

@@ -3156,6 +3150,7 @@ FLUSH TABLES WITH READ LOCK;
31563150

31573151
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info;
31583152
--source include/wait_condition.inc
3153+
--source ../suite/innodb/include/wait_all_purged.inc
31593154
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
31603155

31613156
unlock tables;
@@ -3166,7 +3161,6 @@ connection default;
31663161
SET DEBUG_SYNC= 'RESET';
31673162
drop table t1,t2;
31683163
disconnect con2;
3169-
disconnect con1;
31703164

31713165
--echo #
31723166
--echo # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null'

0 commit comments

Comments
 (0)