Skip to content
Permalink
Browse files
MDEV-25664 Potential hang in purge for virtual columns
ha_innobase::open(): If the table is only being opened by purge
for evaluating virtual column values, avoid invoking
initialize_auto_increment(), because the purge thread may already
be holding an shared latch on the clustered index root page.
Shared latches are not recursive. The additional request would lead
to a hang if another thread has started waiting for an exclusive latch.
  • Loading branch information
dr-m committed May 21, 2021
1 parent 2087d47 commit 9739cf1
Showing 1 changed file with 4 additions and 2 deletions.
@@ -6488,7 +6488,9 @@ ha_innobase::open(const char* name, int, uint)
dict_table_get_format(m_prebuilt->table));
}

if (m_prebuilt->table == NULL
const my_bool for_vc_purge = THDVAR(thd, background_thread);

if (for_vc_purge || m_prebuilt->table == NULL
|| dict_table_is_temporary(m_prebuilt->table)
|| m_prebuilt->table->persistent_autoinc
|| !m_prebuilt->table->is_readable()) {
@@ -6512,7 +6514,7 @@ ha_innobase::open(const char* name, int, uint)
}
}

if (!THDVAR(thd, background_thread)) {
if (!for_vc_purge) {
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
}

0 comments on commit 9739cf1

Please sign in to comment.