PS-10595 [8.4]: Lazy initialization for buffer pool block latches#6033
Open
polchawa-percona wants to merge 3 commits into
Open
PS-10595 [8.4]: Lazy initialization for buffer pool block latches#6033polchawa-percona wants to merge 3 commits into
polchawa-percona wants to merge 3 commits into
Conversation
b79f2ab to
0a7cb18
Compare
[*] Refactor buf_block_init into buf_block_init_light(), performing only lightweight control block setup without creating latches. [*] Introduce lazy, thread-safe latch initialization for buffer blocks via buf_block_ensure_latches_initialized(), guarded by an atomic latches_initialized flag. [*] Call lazy latch initialization when a block is taken from the free list and when initializing pages for read/creation, ensuring latches are created only on first real use. [*] Replace the global buf_chunk_map_reg with a sharded buf_pool_chunk_map, protected by per-shard mutexes to reduce contention during parallel buffer pool creation and resize. [*] Remove the global std::mutex from buf_pool_create/buf_chunk_init; take per-shard locks inside buf_chunk_init and unregister chunks from the appropriate shard maps during buffer pool teardown and resize. [*] Adjust buf_block and buf_pool teardown to free mutexes/rwlocks only for blocks that had latches initialized, and to correctly free all sharded chunk maps.
0a7cb18 to
6877a82
Compare
Contributor
Author
|
Note - the alternative possible solution is: #6037 |
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.
Buffer pool initialization speedup
The patch is based on contribution from Alexey Bychko: adf7b21
Modifications: