MDEV-37360: SIGSEGV in srv_printf_innodb_monitor

srv_printf_innodb_monitor(): After acquiring a latch,
abort the iteration if innodb_adaptive_hash_index=OFF.
If the adaptive hash index was disabled in a concurrently
executing thread, btr_search_sys_t::partition::clear() would have
freed part->heap, leading to us dereferencing a null pointer.

Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Saahil Alam
This commit is contained in:
Marko Mäkelä 2025-08-08 14:11:45 +03:00
commit 9ffec4c1f3

View file

@ -804,9 +804,13 @@ srv_printf_innodb_monitor(
ibuf_print(file);
#ifdef BTR_CUR_HASH_ADAPT
for (ulint i = 0; i < btr_ahi_parts && btr_search_enabled; ++i) {
for (ulint i = 0; i < btr_ahi_parts; ++i) {
const auto part= &btr_search_sys.parts[i];
part->latch.rd_lock(SRW_LOCK_CALL);
if (!btr_search_enabled) {
part->latch.rd_unlock();
break;
}
ut_ad(part->heap->type == MEM_HEAP_FOR_BTR_SEARCH);
fprintf(file, "Hash table size " ULINTPF
", node heap has " ULINTPF " buffer(s)\n",