Skip to content

Fix schema partition lookup during ConfigNode removal - #18686

Merged
CRZbulabula merged 1 commit into
apache:masterfrom
d-wang-commit:fix-confignode-schema-partition-leader-check
Sep 21, 2026
Merged

CRZbulabula merged 1 commit into
apache:masterfrom
d-wang-commit:fix-confignode-schema-partition-leader-check

Conversation

@d-wang-commit

@d-wang-commit d-wang-commit commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Description

Return retryable status during ConfigNode removal

A ConfigNode can still accept requests on existing connections after its local ConfigRegion has been deleted and before its process stops. The slot-based schema partition lookup previously read consensus state without checking leadership, returning EXECUTE_STATEMENT_ERROR (301). This response does not trigger the ConfigNode client's redirection retry.

Call confirmLeader() before reading schema partitions and return its status immediately when the node cannot serve the request. A removed node can return REDIRECTION_RECOMMEND (400) without a leader address, allowing the existing client retry logic to select another ConfigNode.

Tests

  • UT: No unit tests added or modified.
  • IT: Added IoTDBRemoveConfigNodeSchemaPartitionIT with two scenarios: delete a follower's local ConfigRegion while keeping its process and connections alive, then verify redirection and client recovery; remove the current leader while continuously inserting new devices and checking row counts on existing partitions.
  • Validation: the targeted Maven reactor build and both IT cases passed locally (2 tests, 0 failures, 0 errors). The baseline run of the deleted-ConfigRegion case failed with status 301 instead of the expected 400.

Side effects and risks

The tree-model schema partition lookup, getSchemaPartitionTable -> ConfigManager.getSchemaPartition(PathPatternTree, boolean), already calls confirmLeader(). This change adds the same guard to the corresponding table-model lookup, getSchemaPartitionTableWithSlots -> ConfigManager.getSchemaPartition(Map<String, List>), making the two entry paths consistent.

The guard also precedes the empty-database-map fast return. Requests reaching a follower or an unready leader may incur redirection or readiness-check latency. This reuses the existing leadership checks and client retry behavior; it changes no RPC schema, configuration, or persisted format.


This PR has:

  • been self-reviewed.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR
  • ConfigManager: check leadership before the slot-based schema partition lookup.
  • IoTDBRemoveConfigNodeSchemaPartitionIT: cover client recovery after local ConfigRegion deletion and table read/write continuity during leader removal.

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

The change is small, aligns the table-model path with existing leadership-guarded behavior, and is backed by targeted integration tests covering the reported failure mode.

Review effort: Lite
Findings: None

What changed in this PR

This PR fixes table-model schema partition lookup behavior during ConfigNode removal by ensuring leadership/readiness is checked before reading consensus-backed schema partition state, so clients receive a retryable redirection status instead of a non-retryable execution error during the “deleted local ConfigRegion but process still alive” window.

Changes:

  • Added a confirmLeader() guard to the slot-based schema partition lookup path in ConfigManager.
  • Added an integration test validating redirection/client recovery after deleting a follower’s local ConfigRegion while keeping its process/connection alive.
  • Added an integration test validating continuous table read/write behavior while removing the current ConfigNode leader.
File Description
iotdb-core/​confignode/​src/​main/​java/​org/​apache/​iotdb/​confignode/​manager/​ConfigManager.java Adds a leadership/readiness check before serving slot-based schema partition lookups so removal/unready states return retryable status.
integration-test/​src/​test/​java/​org/​apache/​iotdb/​confignode/​it/​removeconfignode/​IoTDBRemoveConfigNodeSchemaPartitionIT.java Adds IT coverage for client recovery on deleted ConfigRegion and for table workload continuity during leader removal.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Check ConfigNode leadership before reading schema partitions by slot.
Add integration coverage for stale connections and reads/writes during leader removal.
@d-wang-commit
d-wang-commit force-pushed the fix-confignode-schema-partition-leader-check branch from 151dbd1 to 8c74a8f Compare September 21, 2026 04:26

@CRZbulabula CRZbulabula 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.

LGTM

@CRZbulabula
CRZbulabula merged commit 4405647 into apache:master Sep 21, 2026
39 of 41 checks passed
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.

3 participants