Repository navigation
Optimize ConfigNode region lookups and reduce metadata copying - #18902
Open
d-wang-commit wants to merge 1 commit into
Open
d-wang-commit wants to merge 1 commit into
d-wang-commit wants to merge 1 commit into
Conversation
Look up the target Region and replica node IDs before copying their metadata. Read leaders directly from the cache instead of building the full leader map.
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
Reduce copying in ConfigNode region maintenance by locating the database and target Region before copying its replica set. With D databases, N Regions and R replicas per Region, lookup and copying decrease from O(D + N × R) to O(D + R), assuming average constant-time hash lookups.
Filter replica node IDs before copying node configurations, and query the leader cache directly instead of building the full leader map, reducing a single leader lookup from O(N) to O(1).
Tests
RegionReplicaSetLookupTest,RegionMaintainHandlerTest, andConsensusGroupCacheTest; all 58 related UTs passed.Side effects and risks
ConfigNode-only changes; deep-copy and leader-election waiting behavior are retained. Candidate configurations now use individual read locks, so concurrent updates may be observed between candidate reads. No RPC or persistence format changes.
This PR has:
Key changed/added classes (or packages if there are too many classes) in this PR
RegionMaintainHandler,PartitionInfo,LoadManager,LoadCache, and related unit tests.