MDEV-23966 btr_search_sys->hash_tables accessed without taking proper ahi latch

This issue is caused by the commit af40a2b4.
In btr_search_update_hash_on_insert(), btr_search_sys->hash_tables
is being accessed without taking proper ahi latch. During buffer pool
resizing, btr_get_search_table() is being accessed and it leads to
segmentation fault.

Reviewed-by: Marko Mäkelä
parent 923ecbdf
......@@ -1797,7 +1797,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
}
rw_lock_t* const latch = btr_get_search_latch(index);
hash_table_t* const table = btr_get_search_table(index);
/* We must not look up "table" before acquiring the latch. */
hash_table_t* table = NULL;
bool locked = false;
if (!page_rec_is_infimum(rec)) {
......@@ -1814,6 +1815,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
goto function_exit;
}
table = btr_get_search_table(index);
ha_insert_for_fold(table, ins_fold, block, ins_rec);
}
......@@ -1829,6 +1831,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
table = btr_get_search_table(index);
}
if (!left_side) {
......@@ -1849,6 +1853,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
table = btr_get_search_table(index);
}
ha_insert_for_fold(table, ins_fold, block, ins_rec);
......@@ -1865,6 +1871,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
table = btr_get_search_table(index);
}
if (!left_side) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment