MDEV-22871 follow-up fix: AHI corruption & leak

Commit bf3c862faa
accidentally introduced two bugs.

btr_search_update_hash_ref(): Pass the correct parameter part->heap.

btr_search_sys_t::free(): Free all memory.

Thanks to Michael Widenius and Thirunarayanan Balathandayuthapani
for pointing out these bugs.
This commit is contained in:
Marko Mäkelä 2020-06-19 12:30:25 +03:00
commit e341fb0dae
2 changed files with 5 additions and 1 deletions

View file

@ -740,7 +740,7 @@ btr_search_update_hash_ref(
mem_heap_free(heap);
}
ha_insert_for_fold(&part->table, heap, fold, block, rec);
ha_insert_for_fold(&part->table, part->heap, fold, block, rec);
MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_ADDED);
}

View file

@ -338,8 +338,12 @@ struct btr_search_sys_t
void free()
{
if (parts)
{
for (ulong i= 0; i < btr_ahi_parts; ++i)
parts[i].free();
ut_free(parts);
parts= nullptr;
}
}
};