mariadb/extra/mariabackup
Marko Mäkelä 2ac7f6cca6 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-01-10 14:24:00 +02:00
..
quicklz MDEV-9566 Add Percona Xtrabackup 2.3.7 2017-04-27 19:12:39 +02:00
backup_copy.cc Merge 10.5 into 10.6 2024-10-03 09:31:39 +03:00
backup_copy.h MDEV-31905 GTID inconsistency 2023-12-22 00:10:23 +01:00
backup_debug.h MDEV-25312 Replace fil_space_t::name with fil_space_t::name() 2021-04-07 18:01:13 +03:00
backup_mysql.cc Merge 10.5 into 10.6 2025-01-08 08:48:21 +02:00
backup_mysql.h Cleanup: Remove changed_pages_bitmap 2024-02-12 17:01:35 +02:00
backup_wsrep.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
CMakeLists.txt MDEV-33091 pcre2 headers aren't found on Solaris 2024-09-05 12:14:06 +10:00
common.h Fix a case of unused-but-set-variable 2024-02-13 14:00:26 +11:00
datasink.cc Merge 10.2 into 10.3 2021-09-22 18:01:41 +03:00
datasink.h MDEV-31039 mariadb-backup: remove global variables ds_data and ds_meta 2023-04-12 15:14:03 +04:00
ds_buffer.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_buffer.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_compress.cc Merge 10.4 into 10.5 2022-08-22 13:38:40 +03:00
ds_compress.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_local.cc Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
ds_local.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_stdout.cc MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
ds_stdout.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_tmpfile.cc Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
ds_tmpfile.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
ds_xbstream.cc Merge 10.4 into 10.5 2021-09-24 08:42:23 +03:00
ds_xbstream.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
encryption_plugin.cc heap-buffer-overflow in mariadb-backup 2025-01-09 10:00:36 +01:00
encryption_plugin.h MDEV-9566 Port Percona Xtrabackup to MariaDB as mariabackup 2017-04-27 19:12:40 +02:00
fil_cur.cc Merge 10.5 into 10.6 2025-01-03 09:10:25 +02:00
fil_cur.h MDEV-30179 mariabackup --backup fails with FATAL ERROR: ... failed 2023-01-10 15:47:13 +05:30
innobackupex.cc Merge branch '10.4' into 10.5 2021-07-31 23:19:51 +02:00
innobackupex.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
read_filt.cc Cleanup: Remove changed_pages_bitmap 2024-02-12 17:01:35 +02:00
read_filt.h Cleanup: Remove changed_pages_bitmap 2024-02-12 17:01:35 +02:00
write_filt.cc Merge branch '10.4' into 10.5 2023-04-24 12:43:47 +02:00
write_filt.h MDEV-31039 mariadb-backup: remove global variables ds_data and ds_meta 2023-04-12 15:14:03 +04:00
wsrep.cc MDEV-31905 GTID inconsistency 2023-12-22 00:10:23 +01:00
xb_regex.h MDEV-14024 PCRE2. 2019-12-21 10:34:02 +01:00
xbcloud.cc Fix few vulnerabilities found by Cppcheck 2023-03-02 14:38:24 +11:00
xbstream.cc MDEV-34348: my_hash_get_key fixes 2024-11-23 08:14:22 -07:00
xbstream.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
xbstream_read.cc MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
xbstream_write.cc MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
xtrabackup.cc MDEV-35049: btr_search_check_free_space_in_heap() is a bottleneck 2025-01-10 14:24:00 +02:00
xtrabackup.h Merge 10.5 into 10.6 2024-02-13 20:42:59 +02:00