You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "CRZbulabula (via GitHub)" <gi...@apache.org> on 2026/06/28 05:43:33 UTC
[PR] Support migrating multiple regions in one MIGRATE REGION statement [iotdb]
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multiple regions in MIGRATE REGION and multiple DataNodes in REMOVE DATANODE [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18046:
URL: https://github.com/apache/iotdb/pull/18046#issuecomment-4825051657
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=18046) **Quality Gate passed**
Issues
 [12 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=18046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=18046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=18046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=18046&metric=new_coverage&view=list)
 [2.8% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=18046&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=18046)
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multiple regions in MIGRATE REGION and multiple DataNodes in REMOVE DATANODE [iotdb]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #18046:
URL: https://github.com/apache/iotdb/pull/18046#issuecomment-4825145340
## [Codecov](https://app.codecov.io/gh/apache/iotdb/pull/18046?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `15.11628%` with `73 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 41.41%. Comparing base ([`fcd52d7`](https://app.codecov.io/gh/apache/iotdb/commit/fcd52d7ff064e7644fd9429d9fa174c37103d0bf?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`dc752b3`](https://app.codecov.io/gh/apache/iotdb/commit/dc752b36aef20113e4662a3922381ae67455d1a9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/iotdb/pull/18046?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...che/iotdb/confignode/manager/ProcedureManager.java](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&filepath=iotdb-core%2Fconfignode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fconfignode%2Fmanager%2FProcedureManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9jb25maWdub2RlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pb3RkYi9jb25maWdub2RlL21hbmFnZXIvUHJvY2VkdXJlTWFuYWdlci5qYXZh) | 0.00% | [63 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ion/config/executor/ClusterConfigTaskExecutor.java](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2Fexecutor%2FClusterConfigTaskExecutor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL2V4ZWN1dG9yL0NsdXN0ZXJDb25maWdUYXNrRXhlY3V0b3IuamF2YQ==) | 0.00% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...yengine/plan/relational/sql/ast/MigrateRegion.java](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Frelational%2Fsql%2Fast%2FMigrateRegion.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9yZWxhdGlvbmFsL3NxbC9hc3QvTWlncmF0ZVJlZ2lvbi5qYXZh) | 42.85% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...tion/config/metadata/region/MigrateRegionTask.java](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&filepath=iotdb-core%2Fdatanode%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fiotdb%2Fdb%2Fqueryengine%2Fplan%2Fexecution%2Fconfig%2Fmetadata%2Fregion%2FMigrateRegionTask.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-aW90ZGItY29yZS9kYXRhbm9kZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaW90ZGIvZGIvcXVlcnllbmdpbmUvcGxhbi9leGVjdXRpb24vY29uZmlnL21ldGFkYXRhL3JlZ2lvbi9NaWdyYXRlUmVnaW9uVGFzay5qYXZh) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iotdb/pull/18046?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #18046 +/- ##
============================================
+ Coverage 41.40% 41.41% +0.01%
Complexity 318 318
============================================
Files 5286 5286
Lines 369547 369583 +36
Branches 47815 47820 +5
============================================
+ Hits 153008 153071 +63
+ Misses 216539 216512 -27
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/iotdb/pull/18046?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support migrating multiple regions in one MIGRATE REGION statement [iotdb]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #18046:
URL: https://github.com/apache/iotdb/pull/18046#issuecomment-4825031724
## [](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=18046) **Quality Gate passed**
Issues
 [10 New issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=18046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_iotdb&pullRequest=18046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_iotdb&pullRequest=18046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=18046&metric=new_coverage&view=list)
 [2.8% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_iotdb&pullRequest=18046&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_iotdb&pullRequest=18046)
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Support multiple regions in MIGRATE REGION and multiple DataNodes in REMOVE DATANODE [iotdb]
Posted by "CRZbulabula (via GitHub)" <gi...@apache.org>.
CRZbulabula merged PR #18046:
URL: https://github.com/apache/iotdb/pull/18046
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org