d-wang-commit opened a new pull request, #18686:
URL: https://github.com/apache/iotdb/pull/18686

   ## 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) when the group no 
longer existed. 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. The regression is covered with real 
ConfigNode processes and the production ConfigNodeClient implementation.
   - 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<TSeriesPartitionSlot>>), 
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. 
The ITs cover recovery and row counts, but do not establish latency bounds or 
exhaust all concurrent removal interleavings. No separate user documentation 
was added for this internal RPC guard.
   
   <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] added integration tests.
   - [x] been tested in a test IoTDB cluster.
   
   <hr>
   
   ##### 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.
   


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