MDEV-35049: Fix bogus rebuild on BTR_CUR_HASH_FAIL

btr_search_info_update_hash(): Do nothing if the record is positioned
on the page supremum or infimum pseudo-record. The adaptive hash index
can only include user records. This deficiency would cause the
adaptive hash index parameters to change between hashing a prefix of
1 field or a prefix of 1 byte.

Reviewed by: Vladislav Lesin
This commit is contained in:
Marko Mäkelä 2025-01-10 16:40:32 +02:00
parent 6b58ee769f
commit c942b31340

View file

@ -506,18 +506,27 @@ static uint32_t btr_search_info_update_hash(const btr_cur_t &cursor) noexcept
cursor.flag == BTR_CUR_BINARY);
dict_index_t *const index= cursor.index();
const uint16_t n_uniq{dict_index_get_n_unique_in_tree(index)};
dict_index_t::ahi &info= index->search_info;
uint32_t left_bytes_fields{info.left_bytes_fields};
uint8_t n_hash_potential= info.n_hash_potential;
buf_block_t *const block= cursor.page_cur.block;
ut_ad(block->page.lock.have_any());
ut_d(const uint32_t state= block->page.state());
ut_ad(state >= buf_page_t::UNFIXED);
ut_ad(!block->page.is_read_fixed(state));
switch (uintptr_t(btr_cur_get_rec(&cursor) - block->page.frame)) {
case PAGE_OLD_INFIMUM:
case PAGE_OLD_SUPREMUM:
case PAGE_NEW_INFIMUM:
case PAGE_NEW_SUPREMUM:
/* The adaptive hash index only includes user records. */
return 0;
}
const dict_index_t *const block_index= block->index;
uint16_t n_hash_helps{block->n_hash_helps};
const uint16_t n_uniq{dict_index_get_n_unique_in_tree(index)};
dict_index_t::ahi &info= index->search_info;
uint32_t left_bytes_fields{info.left_bytes_fields};
uint8_t n_hash_potential= info.n_hash_potential;
uint32_t ret;
if (!n_hash_potential)