[SPARK-54947][CORE] Refactor block mapping with BlockInfoGroup for better block management #53713
+229
−147
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.
What changes were proposed in this pull request?
This PR refactors the block mapping optimization by #52646. The refator contains these main changes:
Instead of using the HashMap for maintaining the block mappings, this PR introduces a new class
BlockInfoGroup.Collectionto manage the block mapping, providing rich APIs for group level block operations, e.g., size, get. Blocks that do not naturally having the mapping will useBlockInfoGroup.Singletoninstead.Integrates the existing
blockInfoWrapperswithBlockInfoGroupfor centralized block management rather than maintaing multiple separate HashMaps. And this changes us to operate blocks on the group level first and then the individual blocks.Replace the block mapping APIs (e.g.,
getBlockIdsFromMapping,removeFromMapping) that are added by [SPARK-53446][CORE] Optimize BlockManager remove operations with cached block mappings #52646 with the new block group APIs, e.g.,getBlockIdsForGroup,removeBlockGroup.Why are the changes needed?
This refactor centralizes the block management with the new data structure and intorduces better block management semantics. It should be good for codebase maintainence for the long term.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Updated tests.
Was this patch authored or co-authored using generative AI tooling?
No.