Skip to content

Optimize ConfigNode region lookups and reduce metadata copying - #18902

Merged
CRZbulabula merged 1 commit into
apache:masterfrom
d-wang-commit:improve-region-replica-lookup
Oct 19, 2026
Merged

CRZbulabula merged 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.
@CRZbulabula
CRZbulabula requested a balanced review from Copilot October 17, 2026 02:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CRZbulabula
CRZbulabula requested a balanced review from Copilot October 19, 2026 01:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CRZbulabula
CRZbulabula merged commit f028736 into apache:master Oct 19, 2026
55 of 56 checks passed
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.

3 participants