mariadb/mysql-test/suite
Marko Mäkelä 5644256598 MDEV-35049: btr_search_check_free_space_in_heap() is a bottleneck
Let us use implement a simple fixed-size allocator for the adaptive hash
index, insted of complicating mem_heap_t or mem_block_info_t.

MEM_HEAP_BTR_SEARCH: Remove.

mem_block_info_t::free_block(), mem_heap_free_block_free(): Remove.

mem_heap_free_top(), mem_heap_get_top(): Remove.

btr_sea::partition::spare: Replaces mem_block_info_t::free_block.
This keeps one spare block per adaptive hash index partition, to
process an insert.

We must not wait for buf_pool.mutex while holding
any btr_sea::partition::latch. That is why we cache one block for
future allocations. This is protected by a new
btr_sea::partition::blocks_mutex in order to relieve pressure on
btr_sea::partition::latch.

btr_sea::partition::prepare_insert(): Replaces
btr_search_check_free_space_in_heap().

btr_sea::partition::erase(): Replaces ha_search_and_delete_if_found().

btr_sea::partition::cleanup_after_erase(): Replaces the most part of
ha_delete_hash_node(). Unlike the previous implementation, we will
retain a spare block for prepare_insert().
This should reduce some contention on buf_pool.mutex.

btr_search.n_parts: Replaces btr_ahi_parts.

btr_search.enabled: Replaces btr_search_enabled. This must hold
whenever buf_block_t::index is set while a thread is holding a
btr_sea::partition::latch.

dict_index_t::search_info: Remove pointer indirection, and use
Atomic_relaxed or Atomic_counter for most fields.

btr_search_guess_on_hash(): Let the caller ensure that latch_mode is
BTR_MODIFY_LEAF or BTR_SEARCH_LEAF. Release btr_sea::partition::latch
before buffer-fixing the block. The page latch that we already acquired
is preventing buffer pool eviction. We must validate both
block->index and block->page.state while holding part.latch
in order to avoid race conditions with buffer page relocation
or buf_pool_t::resize().

btr_search_check_guess(): Remove the constant parameter
can_only_compare_to_cursor_rec=false.

ahi_node: Replaces ha_node_t.

This has been tested by running the regression test suite
with the adaptive hash index enabled:
./mtr --mysqld=--loose-innodb-adaptive-hash-index=ON

Reviewed by: Vladislav Lesin
2025-04-11 07:35:16 +03:00
..
archive Merge branch '10.5' into 10.6 2024-12-17 11:06:09 +11:00
atomic Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
binlog MDEV-35506 commit policy of one-phase-commit even at errored-out binlogging leads to assert 2025-04-03 20:13:10 +03:00
binlog_encryption Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
client
compat Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
csv
encryption Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
engines MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) 2025-03-17 18:11:51 +07:00
federated Allow 'mariadb' as a connection wrapper name for FederatedX. 2025-02-25 16:04:56 +02:00
funcs_1 MDEV-35810 fix test results 2025-01-14 14:01:28 +01:00
funcs_2 Merge 10.5 into 10.6 2025-03-26 17:09:57 +02:00
galera Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
galera_3nodes Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
galera_3nodes_sr galera mtr tests: synchronization between branches and editions 2025-04-02 04:50:11 +02:00
galera_sr Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
gcol MDEV-35000: dict_table_close() breaks STATS_AUTO_RECALC 2025-02-28 09:00:16 +02:00
handler Merge branch '10.5' into 10.6 2024-12-17 11:06:09 +11:00
heap Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
innodb MDEV-35049: btr_search_check_free_space_in_heap() is a bottleneck 2025-04-11 07:35:16 +03:00
innodb_fts Merge 10.6 into 10.11 2025-03-28 10:55:40 +02:00
innodb_gis Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
innodb_i_s
innodb_zip Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
jp
json Merge branch '10.6' into 10.11 2024-10-29 15:24:38 +01:00
large_tests
maria Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
mariabackup MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM 2025-03-31 17:57:35 +02:00
mtr/t Remove dates from all rdiff files 2025-01-05 16:40:11 +02:00
mtr2
multi_source MDEV-36238 Functional Tests for --master-info-file and --show-slave-auth-info 2025-03-18 18:17:02 -06:00
optimizer_unfixed_bugs
parts Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
perfschema Merge 10.6 into 10.11 2025-02-10 14:45:18 +02:00
perfschema_stress
period Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
plugins Merge 10.6 into 10.11 2024-12-19 15:38:53 +02:00
roles Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
rpl MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert 2025-04-03 19:00:02 +03:00
s3 Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
sql_sequence Merge 10.6 into 10.11 2025-03-27 08:01:47 +02:00
storage_engine
stress MDEV-34453 Trying to read 16384 bytes at 70368744161280 outside the bounds of the file: ./ibdata1 2024-09-20 20:26:43 +05:30
sys_vars MDEV-21923: LSN allocation is a bottleneck 2025-04-10 13:02:17 +03:00
sysschema
unit
vcol Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
versioning Merge branch '10.6' into '10.11' 2025-04-02 06:33:39 +02:00
wsrep Merge branch '10.5' into '10.6' 2025-04-02 04:43:24 +02:00