Skip to content

Add fixed-order RegionGroup placement and leader selection by database - #19541

Open
d-wang-commit wants to merge 1 commit into
apache:masterfrom
d-wang-commit:db-fixed-order-placement
Open

d-wang-commit wants to merge 1 commit into
apache:masterfrom
d-wang-commit:db-fixed-order-placement

Conversation

@d-wang-commit

Copy link
Copy Markdown
Contributor

Description

Add DB_FIXED_ORDER to place RegionGroups and select leaders by database. Set region_group_allocate_policy and leader_distribution_policy to DB_FIXED_ORDER, with route_priority_policy=LEADER. ConfigNode rejects incomplete combinations.

With databases a, b, c, DataNodes 1, 2, 3 and RF=2, new groups for c land on [3, 1]. A write to c arriving at DN 3 can run locally. If DN 3 or its replica becomes unavailable, DN 1 takes over when eligible. If neither is eligible, ConfigNode retains the last known leader.

An ineligible placement target triggers a warning and PGP fallback for that database in the current batch. Existing groups retain their replica order when the catalog changes.

Tests

  • FixedOrderRegionBalancerTest, FixedOrderLeaderBalancerTest and ConfigNodeStartupCheckTest cover placement, fallback, leader selection and configuration.
  • All three IoTDBFixedOrderRegionGroupIT cases passed on the earlier revision with IoTConsensus, IoTConsensusV2 and Ratis. The latest placement run passed all seven unit tests.

Side effects and risks

Concentrating a database's groups on the same nodes reduces coordinator forwarding but increases the impact of correlated failures.


This PR has:

  • been self-reviewed.
  • added integration tests.

Key changed/added classes (or packages if there are too many classes) in this PR
  • RegionBalancer and FixedOrderRegionGroupAllocator place new groups and handle per-database fallback.
  • FixedOrderLeaderBalancer selects leaders from persisted replica order.
  • ConfigNodeStartupCheck validates the policy combination.

Place new user RegionGroups on a database-specific DataNode ring window.
Prefer the first running replica in placement order for local writes.
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