mariadb/include
Marko Mäkelä 44a1cb4046 MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size
We deprecate and ignore the parameter innodb_buffer_pool_chunk_size
and let the buffer pool size to be changed in arbitrary 1-megabyte
increments, all the way up to innodb_buffer_pool_size_max,
which must be specified at startup.

If innodb_buffer_pool_size_max is not specified, it will default to
twice the specified innodb_buffer_pool_size.

The buffer pool will be mapped in a contiguous memory area that
will be aligned and partitioned into extents of 8 MiB on 64-bit systems
and 2 MiB on 32-bit systems.

Within an extent, the first few innodb_page_size blocks contain
buf_block_t objects that will cover the page frames in the rest
of the extent. In this way, there is a trivial mapping between
page frames and block descriptors and we do not need any
lookup tables like buf_pool.zip_hash or buf_pool_t::chunk_t::map.

We will always allocate the same number of block descriptors for
an extent, even if we do not need all the buf_block_t in the last
extent in case the innodb_buffer_pool_size is not an integer multiple
of the of extents size.

The minimum innodb_buffer_pool_size is 256*5/4 pages. At the default
innodb_page_size=16k this corresponds to 5 MiB. However, now that the
innodb_buffer_pool_size includes the memory allocated for the block
descriptors, the minimum would be innodb_buffer_pool_size=6m.

When the buffer pool is shrunk, InnoDB will try to inform the operating
system that the underlying memory for part of the virtual address range
is no longer needed and may be zeroed out. On many POSIX-like systems this
is done by madvise(MADV_FREE) where available (Linux, FreeBSD, NetBSD,
OpenBSD, Apple macOS). On Microsoft Windows, VirtualFree(MEM_DECOMMIT)
is invoked.

Innodb_buffer_pool_resize_status: Remove. We will execute
buf_pool_t::resize() synchronously in the thread that is executing
SET GLOBAL innodb_buffer_pool_size. That operation will run until
it completes, or until a KILL statement is executed, the client
is disconnected, the buf_flush_page_cleaner() thread notices that
we are running out of memory, or the server is shut down.

opt_super_large_pages: Declare only on Solaris. Actually, this is
specific to the SPARC implementation of Solaris, but due to us not
having a Solaris development environment, we will not revise this
for other MMU and ISA.

my_large_virtual_alloc(): A new function, similar to my_large_malloc().
On Microsoft Windows, buffer pool resizing is disabled if large pages
are being used.

buf_pool_t::chunk_t::create(): Remove.

buf_pool_t::create(): Initialize all n_blocks of the buf_pool.free list.

buf_pool_t::allocate(): Renamed from buf_LRU_get_free_only().

buf_pool_t::LRU_warned: Changed to Atomic_relaxed<bool>,
only to be modified by the buf_flush_page_cleaner() thread.

buf_pool_t::LRU_shrink(): Check if buffer pool shrinking needs
to process a buffer page.

buf_pool_t::resize(): Always zero out b->page.zip.data.
Failure to do so would cause crashes or corruption in
the test innodb.innodb_buffer_pool_resize due to
duplicated allocation in the buddy system.
Before tarting to shrink the buffer pool, run one batch of
buf_flush_page_cleaner() in order to prevent LRU_warn().
Abort shrinking if the buf_flush_page_cleaner() has LRU_warned.

buf_pool_t::first_to_withdraw: The first block descriptor that is
out of the bounds of the shrunk buffer pool.

buf_pool_t::withdrawn: The list of withdrawn blocks.
If buf_pool_t::resize() is aborted, we must be able to resurrect
the withdrawn blocks in the free list.

buf_pool_t::contains_zip(): Added a parameter for the
number of least significant pointer bits to disregard,
so that we can find any pointers to within a block
that is supposed to be free.

buf_pool_t::is_shrinking(): Return the total number or blocks that
were withdrawn or are to be withdrawn.

buf_pool_t::to_withdraw(): Return the number of blocks that will need to
be withdrawn.

buf_pool_t::usable_size(): Number of usable pages, considering possible
in-progress attempt at shrinking the buffer pool.

buf_page_get_low(): Suppress a MemorySanitizer warning about
an uninitialized (typically all-zero) block->page.id().

buf_pool_t::get_info(): Replaces buf_stats_get_pool_info().

innodb_init_param(): Refactored. We must first compute
srv_page_size_shift and then determine the valid bounds of
innodb_buffer_pool_size.

buf_buddy_shrink(): Replaces buf_buddy_realloc().
Part of the work is deferred to buf_buddy_condense_free(),
which is being executed when we are not holding any
buf_pool.page_hash latch.

buf_buddy_condense_free(): Do not relocate blocks.

buf_buddy_free_low(): Do not care about buffer pool shrinking.
This will be handled by buf_buddy_shrink() and
buf_buddy_condense_free().

buf_buddy_alloc_zip(): Assert !buf_pool.contains_zip()
when we are allocating from the binary buddy system.
Previously we were asserting this on multiple recursion levels.

buf_buddy_block_free(), buf_buddy_free_low():
Assert !buf_pool.contains_zip().

buf_buddy_alloc_from(): Remove the redundant parameter j.

buf_flush_LRU_list_batch(): Add the parameter shrinking.
If we are shrinking, invoke buf_pool_t::LRU_shrink() to see
if we must keep going.

buf_do_LRU_batch(): Skip buf_free_from_unzip_LRU_list_batch()
if we are shrinking the buffer pool. In that case, we want
to minimize the page relocations and just finish as quickly
as possible.

trx_purge_attach_undo_recs(): Limit purge_sys.n_pages_handled()
in every iteration, in case the buffer pool is being shrunk
in the middle of a purge batch.
2025-02-19 11:07:48 +02:00
..
atomic MDEV-19696 - Cleanup gcc sync builtins 2019-07-03 12:11:22 +03:00
mysql Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
providers support lzma < 5.1.3alpha 2022-02-09 19:13:52 +01:00
aligned.h Revert aligned_alloc() addition from MDEV-28836 2022-08-22 09:10:40 +03:00
aria_backup.h S3 is pluggable now 2020-06-19 19:43:07 +02:00
assume_aligned.h Remove a misleading copyright message 2020-03-21 10:25:54 +02:00
big_endian.h Update FSF address 2019-05-11 19:25:02 +03:00
byte_order_generic.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
byte_order_generic_x86.h Fix all warnings given by UBSAN 2021-04-20 12:30:09 +03:00
byte_order_generic_x86_64.h typo fixed. HAVE_mi_uint8korr 2023-11-02 19:42:39 +11:00
CMakeLists.txt MDEV-34348: Consolidate cmp function declarations 2024-11-23 08:14:22 -07:00
decimal.h Added typedef decimal_digits_t (uint16) for number of digits in most 2021-05-19 22:27:27 +02:00
dur_prop.h Merge InnoDB 5.7 from mysql-5.7.9. 2016-09-02 13:22:28 +03:00
errmsg.h test cases for MySQL bugs 2022-01-21 16:02:34 +01:00
ft_global.h MDEV-23269 SIGSEGV in ft_boolean_check_syntax_string on setting ft_boolean_syntax 2021-10-11 17:43:23 +04:00
handler_ername.h MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure 2024-12-12 18:02:00 +02:00
handler_state.h
hash.h Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
heap.h MDEV-35469 Heap tables are calling mallocs to often 2025-01-05 16:40:11 +02:00
ilist.h Merge 10.6 into 10.8 2023-02-10 13:43:53 +02:00
json_lib.h Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
keycache.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
lf.h MDEV-23510: arm64 lf_hash alignment of pointers 2021-02-25 10:06:15 +11:00
little_endian.h Update FSF address 2019-05-11 19:25:02 +03:00
m_ctype.h Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
m_string.h Merge branch '10.6' into 10.11 2024-10-29 15:24:38 +01:00
ma_dyncol.h Merge 10.4 into 10.5 2023-01-03 17:08:42 +02:00
maria.h cleanup: Aria headers 2020-06-19 19:43:07 +02:00
mariadb_capi_rename.h more C API methods in the service_sql 2025-01-28 19:31:29 +01:00
my_alarm.h Merge 10.4 into 10.5 2022-11-08 17:01:28 +02:00
my_alloc.h Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
my_alloca.h Merge branch '10.4' into 10.5 2023-04-24 12:43:47 +02:00
my_atomic.h MDEV-17441 fixup: Remove unused my_atomic long macros 2022-03-24 09:53:52 +02:00
my_atomic_wrapper.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
my_attribute.h Merge 10.5 -> 10.6 2024-12-05 09:20:36 +01:00
my_base.h Merge 10.6 into 10.11 2024-12-19 15:38:53 +02:00
my_bit.h MDEV-34392 Inplace algorithm violates the foreign key constraint 2024-10-01 09:41:56 +05:30
my_bitmap.h Merge 10.6 into 10.11 2024-03-28 09:16:57 +02:00
my_byteorder.h MDEV-25870 Windows - fix ARM64 cross-compilation 2021-06-07 23:15:36 +02:00
my_check_opt.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_cmp.h MDEV-34348: Consolidate cmp function declarations 2024-11-23 08:14:22 -07:00
my_compare.h Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
my_compiler.h MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument 2023-07-12 12:05:59 +03:00
my_counter.h Apply clang-tidy to remove empty constructors / destructors 2023-02-09 16:09:08 +02:00
my_cpu.h Merge 10.5 into 10.6 2025-01-20 09:57:37 +02:00
my_crypt.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_dbug.h Merge branch '10.6' into 10.7 2022-10-04 07:41:35 +02:00
my_decimal_limits.h header typos 2022-12-20 08:55:48 +11:00
my_default.h MDEV-22214 mariadbd.exe calls function mysqld.exe, and crashes 2020-04-10 19:05:26 +02:00
my_dir.h Merge 10.6 into 10.7 2023-01-04 14:52:25 +02:00
my_getopt.h Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
my_global.h Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
my_handler_errors.h MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure 2024-12-12 18:02:00 +02:00
my_libwrap.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_list.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_md5.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
my_minidump.h MDEV-11499 mysqltest, Windows : improve diagnostics if server fails to shutdown 2021-09-24 11:49:28 +02:00
my_net.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_nosys.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_pthread.h Merge 10.5 into 10.6 2025-01-20 09:57:37 +02:00
my_rdtsc.h MDEV-34815 SIGILL error when executing mariadbd compiled for RISC-V with Clang 2024-12-05 02:36:25 +11:00
my_rnd.h remove dead code 2022-07-31 14:54:37 +02:00
my_service_manager.h MDEV-10183 implement service_manager_extend_timeout on Windows 2022-04-11 07:49:43 +02:00
my_stack_alloc.h MDEV-34533 asan error about stack overflow when writing record in Aria 2024-10-16 17:24:46 +03:00
my_stacktrace.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
my_sys.h MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size 2025-02-19 11:07:48 +02:00
my_time.h Merge 10.3 into 10.4 2022-04-06 08:59:09 +03:00
my_tree.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_uctype.h Update FSF Address 2019-05-11 21:29:06 +03:00
my_user.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
my_valgrind.h Cleanup: Remove IF_VALGRIND 2022-04-25 09:40:40 +03:00
my_xml.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
myisam.h MDEV-34348: Consolidate cmp function declarations 2024-11-23 08:14:22 -07:00
myisamchk.h Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
myisammrg.h MDEV-31083 ASAN use-after-poison in myrg_attach_children 2023-05-23 09:16:36 +03:00
myisampack.h MDEV-29473 UBSAN: Signed integer overflow: X * Y cannot be represented in type 'int' in strings/dtoa.c 2022-11-17 17:51:01 +04:00
mysql.h Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
mysql_com.h Merge from 10.4 to 10.5 2024-04-15 17:46:49 +02:00
mysql_com_server.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mysql_embed.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
mysql_time.h Merge branch '5.5' into 10.1 2019-05-11 22:19:05 +03:00
mysql_version.h.in Merge 10.3 into 10.4 2020-10-29 13:38:38 +02:00
mysqld_default_groups.h Fixed that mariadb-# binaries reads their corresponding entry from my.cnf 2019-07-18 15:32:22 +03:00
mysys_err.h MDEV-7947 strcmp() takes 0.37% in OLTP RO 2020-07-23 10:54:33 +03:00
no_valgrind_without_big.inc MDEV-31893 Valgrind reports issues in main.join_cache_notasan 2023-08-10 20:57:42 +02:00
pack.h Merge branch '10.2' into bb-10.2-connector-c-integ-subm 2016-09-21 12:54:56 +02:00
password.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
pfs_file_provider.h perfschema compilation, test and misc fixes 2020-03-10 19:24:23 +01:00
pfs_idle_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_memory_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_metadata_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_socket_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_stage_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_statement_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_table_provider.h P_S 5.7.28 2020-03-10 19:24:22 +01:00
pfs_thread_provider.h Merge branch 'merge-perfschema-5.7' into 10.5 2022-08-02 09:34:15 +02:00
pfs_transaction_provider.h cleanup: pass trxid by value 2020-03-10 19:24:23 +01:00
probes_mysql.d.base Update FSF Address 2019-05-11 21:29:06 +03:00
probes_mysql.h Update FSF Address 2019-05-11 21:29:06 +03:00
probes_mysql_nodtrace.h.in Merge branch '5.5' into 10.0 2016-02-15 22:50:59 +01:00
queues.h MDEV-34348: Consolidate cmp function declarations 2024-11-23 08:14:22 -07:00
rijndael.h Update FSF Address 2019-05-11 21:29:06 +03:00
scope.h MDEV-22441 SCOPE_VALUE macro for temporary values 2025-01-14 18:56:13 +03:00
service_versions.h Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
source_revision.h.in SOURCE_REVISION should always be defined in source_revision.h 2017-11-01 13:20:32 +00:00
span.h Apply clang-tidy to remove empty constructors / destructors 2023-02-09 16:09:08 +02:00
sql_common.h Merge branch '10.5' into 10.6 2023-12-17 11:20:43 +01:00
ssl_compat.h Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00
sslopt-case.h MDEV-25511: Command line tools don't support CRL parameters 2021-05-31 08:29:37 +02:00
sslopt-longopts.h Merge branch '10.6' into 10.11 2024-05-10 20:02:18 +02:00
sslopt-vars.h MDEV-27105 --ssl option set as default for mariadb CLI 2022-07-28 17:18:39 +02:00
t_ctype.h Update FSF Address 2019-05-11 21:29:06 +03:00
thr_alarm.h MDEV-25602 get rid of __WIN__ in favor of standard _WIN32 2021-06-06 13:21:03 +02:00
thr_lock.h MDEV-13115: Implement SELECT SKIP LOCKED 2021-04-08 16:51:36 +10:00
thr_timer.h MDEV-16264 - prerequisite patch, periodic thr_timer 2019-11-15 16:50:22 +01:00
typelib.h Added 'const' to arguments in get_one_option and find_typeset() 2021-02-08 12:16:29 +02:00
violite.h MDEV-33582 Add more warnings to be able to better diagnose network issues 2024-03-05 20:19:49 +02:00
waiting_threads.h header typos 2022-12-20 08:55:48 +11:00
welcome_copyright_notice.h Update FSF Address 2019-05-11 21:29:06 +03:00
wqueue.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
wsrep.h Reduce compilation dependencies on wsrep_mysqld.h 2022-08-31 11:05:23 +03:00