Skip to content

Commit

Permalink
MDEV-25691 fixup: Avoid MDL acquisition in purge
Browse files Browse the repository at this point in the history
row_purge_remove_clust_if_poss_low(): When dict_table_open_on_id()
is being invoked with the data dictionary locked, it will not
actually acquire MDL. Remove the MDL that became dead code in
commit c366845.
  • Loading branch information
dr-m committed Aug 31, 2021
1 parent e94172c commit 4362ed1
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions storage/innobase/row/row0purge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ row_purge_remove_clust_if_poss_low(
dict_index_t* index = dict_table_get_first_index(node->table);
table_id_t table_id = 0;
index_id_t index_id = 0;
MDL_ticket* mdl_ticket = nullptr;
dict_table_t *table = nullptr;
pfs_os_file_t f = OS_FILE_CLOSED;

Expand All @@ -117,8 +116,7 @@ row_purge_remove_clust_if_poss_low(
purge_sys.check_stop_FTS();
dict_sys.mutex_lock();
table = dict_table_open_on_id(
table_id, true, DICT_TABLE_OP_OPEN_ONLY_IF_CACHED,
node->purge_thd, &mdl_ticket);
table_id, true, DICT_TABLE_OP_OPEN_ONLY_IF_CACHED);
if (!table) {
dict_sys.mutex_unlock();
} else if (table->n_rec_locks) {
Expand All @@ -143,8 +141,7 @@ row_purge_remove_clust_if_poss_low(
mtr.commit();
close_and_exit:
if (table) {
dict_table_close(table, true, false,
node->purge_thd, mdl_ticket);
dict_table_close(table, true, false);
dict_sys.mutex_unlock();
}
return success;
Expand Down Expand Up @@ -175,25 +172,16 @@ row_purge_remove_clust_if_poss_low(
table->space = nullptr;
table->file_unreadable = true;
}
table = nullptr;
dict_sys.mutex_unlock();
if (!mdl_ticket);
else if (MDL_context* mdl_context =
static_cast<MDL_context*>(
thd_mdl_context(node->
purge_thd))) {
mdl_context->release_lock(mdl_ticket);
mdl_ticket = nullptr;
}
table = nullptr;
}
f = fil_delete_tablespace(space_id);
}

mtr.commit();

if (table) {
dict_table_close(table, true, false,
node->purge_thd, mdl_ticket);
dict_table_close(table, true, false);
dict_sys.mutex_unlock();
table = nullptr;
}
Expand Down

0 comments on commit 4362ed1

Please sign in to comment.