MDEV-22186 : Add innodb_buffer_pool_in_core_file to control buffer pool in core#4651
Open
mariadb-TafzeelShams wants to merge 1 commit into10.11from
Open
MDEV-22186 : Add innodb_buffer_pool_in_core_file to control buffer pool in core#4651mariadb-TafzeelShams wants to merge 1 commit into10.11from
mariadb-TafzeelShams wants to merge 1 commit into10.11from
Conversation
a4d739d to
b9adbc6
Compare
…l in cores Problem: There is no control to include or exclude the InnoDB buffer pool from core files, which can lead to unnecessarily large core dumps or prevent capturing useful memory state. Solution: Introduce a dynamic global system variable innodb_buffer_pool_in_core_file. When set to OFF (or via --skip-innodb-buffer-pool-in-core-file), the server attempts to exclude the buffer pool from core dumps using madvise(MADV_DONTDUMP) where supported. If exclusion cannot be guaranteed, @@core_file is automatically disabled and a warning is emitted to respect the user’s intention. - innodb_buffer_pool_in_core_file Determines whether the buffer pool should be included in core files when @@core_file=ON. No effect if @@core_file=OFF. Default: OFF on non-debug builds with MADV_DONTDUMP support, ON otherwise. - innobase_should_madvise_buf_pool() Evaluates @@core_file and @@innodb_buffer_pool_in_core_file to determine if MADV_DONTDUMP should be applied. - innobase_disable_core_dump() Clears TEST_CORE_ON_SIGNAL, disabling @@core_file when buffer pool exclusion cannot be guaranteed. - buf_pool_t::madvise_dont_dump() Applies MADV_DONTDUMP to buffer pool memory. Emits warning and returns false if unsupported or fails. - buf_pool_t::madvise_dump() Applies MADV_DODUMP to re-include buffer pool in core dumps. Returns false if unsupported or fails. - buf_pool_t::madvise_update_dump() Reevaluates and updates madvise state. If exclusion fails, invokes innobase_disable_core_dump(). - buf_pool_t::buf_pool_should_madvise_dont_dump Tracks current dump state, protected by buf_pool_t::mutex. - buf_pool_t::create() Initializes buf_pool_should_madvise_dont_dump and conditionally applies MADV_DONTDUMP after allocation; disables core dumps on failure. - buf_pool_t::close() Calls madvise_dump() before releasing memory if MADV_DONTDUMP was applied. - buf_pool_t::resize() Invokes madvise_update_dump(true) to reapply correct madvise state after resizing. - innodb_srv_buffer_pool_in_core_file_update() Update hook that updates srv_buffer_pool_in_core_file and calls buf_pool.madvise_update_dump(). - srv_buffer_pool_in_core_file Global variable backing @@innodb_buffer_pool_in_core_file. Inspired from mysql commit@891460995137598a6e0ae3684ba1cc6ccd0c3ca3
b9adbc6 to
1b4a940
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
MDEV-22186: Add
innodb_buffer_pool_in_core_fileto control buffer pool in coresProblem:
There is no control to include or exclude the InnoDB buffer pool from core files,
which can lead to unnecessarily large core dumps or prevent capturing useful
memory state.
Solution:
Introduce a dynamic global system variable
innodb_buffer_pool_in_core_file.When set to
OFF(or via--skip-innodb-buffer-pool-in-core-file),the server attempts to exclude the buffer pool from core dumps using
madvise(MADV_DONTDUMP)where supported. If exclusion cannot be guaranteed,@@core_fileis automatically disabled and a warning is emitted to respect theuser’s intention.
Inspired from mysql commit@891460995137598a6e0ae3684ba1cc6ccd0c3ca3
How can this PR be tested?
Added
mysql-test/suite/innodb/t/mysqld_core_dump_without_buffer_pool.test
mysql-test/suite/innodb/t/mysqld_core_dump_without_buffer_pool_dynamic.test
mysql-test/suite/innodb/t/mysqld_core_dump_without_buffer_pool_with_resizing.test
Basing the PR against the correct MariaDB version
Backward compatibility
The default value of
innodb_buffer_pool_in_core_filepreserves existing behavior:This ensures the new variable behaves the same way as previous versions by default.