Skip to content

Optimize ConfigNode region lookups and reduce metadata copying - #18902

Open
d-wang-commit wants to merge 1 commit into
apache:masterfrom
d-wang-commit:improve-region-replica-lookup
Open

d-wang-commit wants to merge 1 commit into
apache:masterfrom
d-wang-commit:improve-region-replica-lookup

Conversation

@d-wang-commit

Copy link
Copy Markdown
Contributor

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

  • Added/updated RegionReplicaSetLookupTest, RegionMaintainHandlerTest, and ConsensusGroupCacheTest; all 58 related UTs passed.
  • No IT changes included. Local 1C3D multi-database Region expansion/shrink validation passed.
  • English reactor verification, Chinese-locale packaging, and Spotless 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:

  • been self-reviewed.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

RegionMaintainHandler, PartitionInfo, LoadManager, LoadCache, and related unit tests.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant