Browse Source

MDEV-36649 dict_acquire_mdl_shared() aborts when table mode is DICT_TABLE_OP_OPEN_ONLY_IF_CACHED

- InnoDB fails to check the table is being dropped or evicted
while acquiring the MDL for the table when table open operation
mode is DICT_TABLE_OP_OPEN_ONLY_IF_CACHED. This is caused by
the commit 337bf8ac4b (MDEV-36122)

Fix:
===
dict_acquire_mdl_shared(): If the table is evicted or dropped when
table operation mode is DICT_TABLE_OP_OPEN_IF_CACHED then return
nullptr
pull/3989/head
Thirunarayanan Balathandayuthapani 7 months ago
parent
commit
dac3d702f7
  1. 10
      mysql-test/suite/innodb/r/stats_persistent.result
  2. 12
      mysql-test/suite/innodb/t/stats_persistent.test
  3. 2
      storage/innobase/dict/dict0dict.cc

10
mysql-test/suite/innodb/r/stats_persistent.result

@ -17,3 +17,13 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
#
# MDEV-36649 dict_acquire_mdl_shared() aborts when table
# mode is DICT_TABLE_OP_OPEN_ONLY_IF_CACHED
#
set @old_defragment_stats_accuracy= @@innodb_defragment_stats_accuracy;
SET GLOBAL innodb_defragment_stats_accuracy=1;
CREATE TABLE t (a INT ) ENGINE=INNODB;
INSERT INTO t SELECT * FROM seq_1_to_1000;
DROP TABLE t;
set global innodb_defragment_stats_accuracy= @old_defragment_stats_accuracy;

12
mysql-test/suite/innodb/t/stats_persistent.test

@ -1,4 +1,5 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
@ -26,3 +27,14 @@ SET DEBUG_SYNC= 'RESET';
DROP TABLE t1;
--source include/wait_until_count_sessions.inc
--echo #
--echo # MDEV-36649 dict_acquire_mdl_shared() aborts when table
--echo # mode is DICT_TABLE_OP_OPEN_ONLY_IF_CACHED
--echo #
set @old_defragment_stats_accuracy= @@innodb_defragment_stats_accuracy;
SET GLOBAL innodb_defragment_stats_accuracy=1;
CREATE TABLE t (a INT ) ENGINE=INNODB;
INSERT INTO t SELECT * FROM seq_1_to_1000;
DROP TABLE t;
set global innodb_defragment_stats_accuracy= @old_defragment_stats_accuracy;

2
storage/innobase/dict/dict0dict.cc

@ -795,6 +795,8 @@ lookup:
dict_sys.freeze(SRW_LOCK_CALL);
goto return_without_mdl;
}
else
goto return_without_mdl;
if (*mdl)
{

Loading…
Cancel
Save