mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-35049: Avoid building AHI beyond unique field prefix
During a workload, an adaptive hash index had been built on UNIQUE INDEX(ID) on SYS_TABLES, and during a DROP TABLE operation the adaptive hash index would be widened to cover also the PRIMARY KEY(NAME) field that the index includes: (ID,NAME). Such an adaptive hash index is unlikely to satisfy (m)any queries. Let us limit the AHI prefix to the unique fields. Reviewed by: Vladislav Lesin
This commit is contained in:
parent
5f7b2a3ced
commit
4221ed1d7d
1 changed files with 4 additions and 5 deletions
|
@ -523,7 +523,8 @@ static uint32_t btr_search_info_update_hash(const btr_cur_t &cursor) noexcept
|
|||
|
||||
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)};
|
||||
const uint16_t n_uniq=
|
||||
uint16_t(index->n_uniq ? index->n_uniq : index->n_fields);
|
||||
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;
|
||||
|
@ -1472,10 +1473,8 @@ static void btr_search_build_page_hash_index(dict_index_t *index,
|
|||
|
||||
/* Check that the values for hash index build are sensible */
|
||||
ut_ad(n_bytes_fields);
|
||||
|
||||
if (dict_index_get_n_unique_in_tree(index) <
|
||||
btr_search_get_n_fields(n_bytes_fields))
|
||||
return;
|
||||
ut_ad(btr_search_get_n_fields(n_bytes_fields) <=
|
||||
(index->n_uniq ? index->n_uniq : index->n_fields));
|
||||
|
||||
const page_t *const page= block->page.frame;
|
||||
size_t n_cached= 0;
|
||||
|
|
Loading…
Reference in a new issue