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.
This commit is contained in:
Marko Mäkelä 2021-05-21 18:50:30 +03:00
parent 2087d47aae
commit 9739cf1859

View file

@ -6488,7 +6488,9 @@ no_such_table:
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 @@ no_such_table:
}
}
if (!THDVAR(thd, background_thread)) {
if (!for_vc_purge) {
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
}