Skip to content

Validate region operation requests before submitting procedures - #18696

Open
CRZbulabula wants to merge 3 commits into
apache:masterfrom
CRZbulabula:yongzao/region-operation-cli-result
Open

CRZbulabula wants to merge 3 commits into
apache:masterfrom
CRZbulabula:yongzao/region-operation-cli-result

Conversation

@CRZbulabula

@CRZbulabula CRZbulabula commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

What problem does this solve?

MIGRATE REGION, RECONSTRUCT REGION, EXTEND REGION, and REMOVE REGION could skip invalid IDs or submit procedures for earlier regions before encountering a later validation failure. For example, requesting regions 12,99 could start work on region 12 even though region 99 does not exist.

What changed?

  • Validate the complete request under the region-operation submission lock before submitting any procedure. Reject duplicate/missing region IDs, empty region lists, unregistered DataNode IDs, and identical migration source/destination IDs with the existing operation-specific error code and a concrete reason.
  • Complete existing per-region checks (including replica placement and conflicting operations) before submitting procedures in input order. Any validation failure leaves zero procedures submitted.
  • Reject an unregistered REMOVE REGION target instead of cleaning up its partition-table entries.
  • Use the existing DataNode/JDBC/CLI exception path to report errors. No new status code, warning channel, or protocol field is required. Valid requests still return the usual submission success; procedure execution remains asynchronous.

This is validation-before-submission, not a transaction over asynchronous procedure execution or a rollback guarantee for failures during procedure submission.

Tests

  • Parameterized ConfigNode tests cover all four commands, tree/table models, and DataRegion/SchemaRegion: duplicates, missing IDs at the start/end, all-invalid/empty requests, invalid DataNodes, migration to the same node, later-region conflicts/invalid replica placement/missing coordinators, valid submission order, and ReadOnly removal. Rejection cases assert zero procedure submissions and no partition-table cleanup.
  • DataNode, JDBC (execute and executeUpdate), and CLI tests verify error-code/message propagation and the CLI error return status.
  • English and Chinese full-reactor test-compile and the four focused unit-test classes pass; no integration-test cluster was started.
  • Spotless/checkstyle checks, locale constant/placeholder parity, and git diff --check pass.

Validation commands:

mvn test-compile -DskipTests -Dmaven.build.cache.enabled=false
mvn test-compile -P with-zh-locale -DskipTests -Dmaven.build.cache.enabled=false
mvn test -pl iotdb-core/confignode,iotdb-client/cli -am -Dtest=ProcedureManagerRegionOperationTest,ConfigExecutionTest,IoTDBStatementTest,AbstractCliTest -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.build.cache.enabled=false
mvn test -pl iotdb-core/confignode,iotdb-client/cli -am -P with-zh-locale -Dtest=ProcedureManagerRegionOperationTest,ConfigExecutionTest,IoTDBStatementTest,AbstractCliTest -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.build.cache.enabled=false

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 High severity

Open (1)
What changed in this PR

Improves region-operation submission reporting by preserving ConfigNode status summaries through DataNode, JDBC, and CLI layers.

Changes:

  • Adds per-region success/failure summaries and localized messages.
  • Handles invalid, empty, duplicate, and null DataNode inputs.
  • Exposes successful submission messages through JDBC warnings and CLI output.
File Description
iotdb-core/​datanode/​src/​main/​java/​org/​apache/​iotdb/​db/​queryengine/​plan/​execution/​config/​executor/​ClusterConfigTaskExecutor.java Updated as part of this pull request.
iotdb-core/​confignode/​src/​test/​java/​org/​apache/​iotdb/​confignode/​manager/​ProcedureManagerReconstructRegionTest.java Updated as part of this pull request.
iotdb-core/​confignode/​src/​main/​java/​org/​apache/​iotdb/​confignode/​manager/​ProcedureManager.java Updated as part of this pull request.
iotdb-core/​confignode/​src/​main/​i18n/​zh/​org/​apache/​iotdb/​confignode/​i18n/​ManagerMessages.java Updated as part of this pull request.
iotdb-core/​confignode/​src/​main/​i18n/​en/​org/​apache/​iotdb/​confignode/​i18n/​ManagerMessages.java Updated as part of this pull request.
iotdb-client/​jdbc/​src/​test/​java/​org/​apache/​iotdb/​jdbc/​IoTDBStatementTest.java Updated as part of this pull request.
iotdb-client/​jdbc/​src/​main/​java/​org/​apache/​iotdb/​jdbc/​IoTDBStatement.java Updated as part of this pull request.
iotdb-client/​cli/​src/​main/​java/​org/​apache/​iotdb/​cli/​AbstractCli.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.

@CRZbulabula CRZbulabula changed the title Improve region operation submission results in CLI Validate region operation requests before submitting procedures Sep 23, 2026
@CRZbulabula
CRZbulabula requested a lite review from Copilot September 23, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified, and all approval assessments support approval.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The changes span asynchronous procedure validation and multiple client and integration layers, warranting final human review.

Review effort: Lite
Findings: None

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.

2 participants