CRZbulabula opened a new pull request, #18046: URL: https://github.com/apache/iotdb/pull/18046
## What `MIGRATE REGION` previously accepted only a single region id: ```sql MIGRATE REGION 1 FROM 4 TO 5 ``` This PR lets it accept a comma-separated list of region ids while keeping a single source (`FROM`) and destination (`TO`) DataNode: ```sql MIGRATE REGION 1, 2, 3 FROM 4 TO 5 ``` All listed regions are migrated from the source DataNode to the destination DataNode. The single-region form continues to work unchanged (the list grammar accepts one-or-more ids). ## Why Operators draining or rebalancing a DataNode often need to move several regions between the same pair of DataNodes. Today that requires one statement per region. Supporting a region list in a single statement makes this a one-liner and matches the multi-region shape already used by `EXTEND REGION` / `REMOVE REGION` / `RECONSTRUCT REGION`. ## How - **Grammar** (both data models): `migrateRegion` / `migrateRegionStatement` now use `regionIds+=INTEGER_LITERAL (COMMA regionIds+=INTEGER_LITERAL)*` instead of a single `regionId`. - **Thrift** `TMigrateRegionReq`: `i32 regionId` -> `list<i32> regionIds`. - **Parsers** (`ASTVisitor`, `AstBuilder`), **AST node** `MigrateRegion`, and **statement** `MigrateRegionStatement`: carry `List<Integer> regionIds`. - **`ProcedureManager#migrateRegion`**: resolves the fixed source/destination DataNodes once, then loops over the de-duplicated region ids, submitting one `RegionMigrateProcedure` per region. Per-region results are aggregated into the `TSStatus` sub-status with a per-region message, mirroring the existing `EXTEND` / `REMOVE REGION` reporting. Unknown source/destination DataNode ids now fail fast with a clear message instead of NPE-ing. The per-region `RegionMigrateProcedure` is unchanged — the change only fans out the existing single-region procedure across the requested regions. ## Tests - Tree-model and table-model parser unit tests for single- and multi-region `MIGRATE REGION` (`MigrateRegionMultiRegionParseTest`, `MigrateRegionMultiRegionStatementTest`). - A 1C5D integration test (`IoTDBMigrateMultiRegionForIoTV1IT`) that migrates multiple regions from one DataNode to another in a single statement and asserts every region left the source and joined the destination. Build verified: thrift + ANTLR regeneration, `iotdb-core/datanode` and `iotdb-core/confignode` compile, `integration-test` test-compiles, `spotless:check` passes, and the parser unit tests pass (4/4). -- 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]
