JackieTien97 opened a new pull request, #19121:
URL: https://github.com/apache/iotdb/pull/19121

   ## Description
   
   ### Problem
   
   `-DintegrationTest.dataRegionPerDataNode=N` is meant to pin the number of 
DataRegions per DataNode in IT clusters, and the daily TableSimpleIT "single 
region" job (#14659) sets it to 1. Since #14659, `DataNodeWrapper` has written 
the value into the DataNode configuration only. Only the ConfigNode reads 
`data_region_per_data_node` (`ConfigNodeDescriptor`, used by 
`ClusterSchemaManager.adjustRegionGroupNum`), and `ConfigNodeWrapper` never 
wrote it, so the flag never had any effect. Since the PROACTIVE default 
(#18692), the per-database DataRegionGroup maximum follows the host's core 
count instead: ceil(0.5 × cores) in a 1C1D cluster.
   
   The `<DataRegionPerDataNode>` failsafe system property in 
`integration-test/pom.xml` is a dead name: the framework reads 
`integrationTest.dataRegionPerDataNode`. The flag reached the test JVM only 
because failsafe forwards command-line user properties.
   
   ### Fix
   
   - `ConfigNodeWrapper` reads the property the same way `DataNodeWrapper` does 
and writes `data_region_per_data_node` into the ConfigNode configuration.
   - It is written as a **common** property, not a node property. The generated 
`iotdb-system.properties` holds the common block followed by the node block, 
and the later duplicate key wins. As a node property it would override the 
values that tests set through `CommonConfig.setDataRegionPerDataNode(...)` (for 
example `IoTDBDatabaseMixedRegionGroupPolicyIT`, `IoTDBTableAggregationIT` and 
`IoTDBCollectFanInIT`). As a common property, an explicit test setting still 
takes precedence over the command-line flag.
   - The failsafe system property is renamed to 
`integrationTest.dataRegionPerDataNode`, so the pom default (0) reaches the 
test JVM and a profile can also set it.
   
   Without the flag the ConfigNode now gets `data_region_per_data_node=0`, 
which is the server default, so ordinary IT runs behave as before.
   
   ### Behavior note
   
   With `=1`, a database in a 1C1D cluster is capped at 2 DataRegionGroups, not 
1: `default_data_region_group_num_per_database=2` is the per-database minimum 
and also the floor of the maximum. After this change the daily "single region" 
job runs with a cap of 2 per database regardless of the runner's core count, 
the same as on a 4-core runner. If the job should use one region per database, 
it would also have to set that minimum to 1; this PR does not change it.
   
   ### Verification
   
   Local runs on a 10-core Mac with JDK 21 and `-PTableSimpleIT` (1C1D), using 
the daily job's `-DDataNodeMaxHeapSize=1024 -DintegrationTest.forkCount=2`, ran 
`IoTDBMultiTAGsWithAttributesTableIT` (database `db`) and 
`IoTDBDatabaseMixedRegionGroupPolicyIT` (sets 4 explicitly). The values come 
from the ConfigNode log: its startup configuration dump, 
`[AdjustRegionGroupNum] The maximum number of DataRegionGroups for Database: db 
is adjusted to: N`, and the `[CreateRegionGroups]` lines.
   
   | Build | Flag | ConfigNode `dataRegionPerDataNode` | `db` max | 
DataRegionGroups created for `db` | MixedRegion IT (explicit 4) |
   |---|---|---|---|---|---|
   | before | none | 0 | 5 | 5 | 4, passed |
   | before | `=1` | **0** | **5** | 5 | 4, passed |
   | after | `=1` | 1 | **2** | 2 | 4, passed |
   | after | none | 0 | 5 | 5 | 4, passed |
   | after | `=3` | 3 | 3 | 3 | 4, passed |
   
   All 35 tests passed in each run. Additional post-fix runs, all passing:
   
   - `IoTDBSetConfigurationIT` (SimpleIT, 11/11). It hot-reloads 
`data_region_per_data_node` and checks the ConfigNode configuration file, which 
now already contains the key.
   - `IoTDBCollectFanInIT` (9/9) and `IoTDBTableAggregationIT` (60/60) under 
TableSimpleIT with `=1`. Their ConfigNodes used the values these tests set (3 
and 2), not the flag.
   
   No new test is added: the flag only matters with the daily job's command 
line, and the precedence of explicit test values is covered by 
`IoTDBDatabaseMixedRegionGroupPolicyIT`.
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious
     for an unfamiliar reader.
   - [x] been tested in a test IoTDB cluster (IT clusters, see Verification).
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) 
in this PR
   
   - 
`integration-test/src/main/java/org/apache/iotdb/it/env/cluster/node/ConfigNodeWrapper.java`
   - `integration-test/pom.xml`
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to