Skip to content

Commit c942b31

Browse files
committed
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
1 parent 6b58ee7 commit c942b31

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

storage/innobase/btr/btr0sea.cc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -506,18 +506,27 @@ static uint32_t btr_search_info_update_hash(const btr_cur_t &cursor) noexcept
506506
cursor.flag == BTR_CUR_BINARY);
507507

508508
dict_index_t *const index= cursor.index();
509-
const uint16_t n_uniq{dict_index_get_n_unique_in_tree(index)};
510-
dict_index_t::ahi &info= index->search_info;
511-
512-
uint32_t left_bytes_fields{info.left_bytes_fields};
513-
uint8_t n_hash_potential= info.n_hash_potential;
514509
buf_block_t *const block= cursor.page_cur.block;
515510
ut_ad(block->page.lock.have_any());
516511
ut_d(const uint32_t state= block->page.state());
517512
ut_ad(state >= buf_page_t::UNFIXED);
518513
ut_ad(!block->page.is_read_fixed(state));
514+
515+
switch (uintptr_t(btr_cur_get_rec(&cursor) - block->page.frame)) {
516+
case PAGE_OLD_INFIMUM:
517+
case PAGE_OLD_SUPREMUM:
518+
case PAGE_NEW_INFIMUM:
519+
case PAGE_NEW_SUPREMUM:
520+
/* The adaptive hash index only includes user records. */
521+
return 0;
522+
}
523+
519524
const dict_index_t *const block_index= block->index;
520525
uint16_t n_hash_helps{block->n_hash_helps};
526+
const uint16_t n_uniq{dict_index_get_n_unique_in_tree(index)};
527+
dict_index_t::ahi &info= index->search_info;
528+
uint32_t left_bytes_fields{info.left_bytes_fields};
529+
uint8_t n_hash_potential= info.n_hash_potential;
521530
uint32_t ret;
522531

523532
if (!n_hash_potential)

0 commit comments

Comments
 (0)