Add proactive RegionGroup allocation and policy hot reload - #18692
d-wang-commit wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds proactive Schema/Data RegionGroup allocation and policy hot reload, with slot-aware balancing and recovery behavior.
Changes:
- Adds PROACTIVE policy, defaults, and documentation.
- Implements distinct-slot allocation and active-slot retention.
- Adds hot-reload handling plus extensive unit/integration tests.
| File | Description |
|---|---|
| iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template | Updated as part of this pull request. |
| iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/partition/PartitionManagerProactiveExtensionTest.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/load/balancer/partition/DataPartitionPolicyTableProactiveTest.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/conf/RegionGroupExtensionPolicyConfigTest.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/DatabasePartitionTable.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/RegionGroupExtensionPolicy.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/partition/DataPartitionPolicyTable.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java | Updated as part of this pull request. |
| iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java | Updated as part of this pull request. |
| integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBProactiveRegionGroupExtensionIT.java | Updated as part of this pull request. |
| integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBProactiveRegionGroupDistributionIT.java | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8088887 to
d54ff28
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Empty partition entries can cause incorrect proactive RegionGroup allocation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Resolved since last review (1)
…to the maximum RegionGroup number. Cover allocation, recovery, and policy switching with unit and integration tests.
d54ff28 to
22231b1
Compare
| && partitionInfo.getAllRegionGroupIds(database, consensusGroupType).stream() | ||
| .allMatch( | ||
| regionGroupId -> | ||
| RegionGroupStatus.Disabled.equals( | ||
| getLoadManager().getRegionGroupStatus(regionGroupId)))) { |
There was a problem hiding this comment.
The max region group number caps any extra allocation. Also, a successfully created group is immediately activated, so subsequent requests no longer satisfy the “all disabled” condition. Given the bounded impact, we’ll keep the current implementation


Description
Policy use cases
The configuration template describes the intended scenarios as follows (quoted verbatim).
SchemaRegionGroups/DataRegionGroups:
Proactive RegionGroup allocation
Sparse databases can keep using only a few RegionGroups under AUTO even when resources are available. Add PROACTIVE for SchemaRegionGroups and DataRegionGroups, and make it the default in ConfigNodeConfig and the configuration template.
PROACTIVE counts distinct persisted and pending series slots separately for schema and data. It grows toward one group per active slot, respects the resource-derived maximum, and follows AUTO's configured minimum. If all groups of the requested type are disabled, one RegionGroup can be allocated within the maximum.
For data allocation and recovery, calculate the retained-slot limit from active assignments, with a minimum of one, instead of the total configured slot count. With 1,000 slots and six active devices, switching from AUTO (with two existing groups) to PROACTIVE can grow to six groups: each old group retains 1 slot and 4 slots (got unassigned first) then use the 4 new groups for new partitions.
Policy hot reload
Leaving CUSTOM refreshes resource caps in all cases.
CUSTOM's maximum cannot be lowered, even to the current group count.
Expansion requires subsequent partition allocation; historical partitions stay unchanged.
Tests
Added UTs:
Existing ClusterSchemaManagerTest and DataPartitionPolicyTableTest provide resource-limit and allocation regression coverage.
Added ITs:
The recorded local targeted run completed with 65 UT cases (0 failures, 0 errors, 3 skipped) and all six hot-reload IT cases passing. The topology matrix and existing IoTDBPartitionInheritStrategyIT were not part of that run.
Side effects and risks
Changing the default from AUTO to PROACTIVE can create more RegionGroups earlier, increasing consensus, memory, and storage overhead within resource limits. Explicit AUTO and CUSTOM settings remain available. Policy changes can affect placement of newly allocated partitions, but do not migrate historical data or shrink existing groups. Allocation may still fail when insufficient DataNodes are available.
This PR has:
for an unfamiliar reader.
Key changed/added classes (or packages if there are too many classes) in this PR