Pengzna opened a new pull request, #17233:
URL: https://github.com/apache/iotdb/pull/17233

   NOTE: This PR is implemented by Claude Opus 4.6, I proposed the entire plans 
and prompts and have carefully reviewed this PR.
   
   ## Problem
   
   When using IoTConsensusV2, cluster initialization may deadlock during 
DataRegion creation (e.g., for `root.__audit`), causing "After 30 times retry, 
the cluster can't work!".
   
   **Root cause:** Circular dependency between DataNode and ConfigNode:
   1. ConfigNode holds `PipeTaskCoordinatorLock` → `pushSinglePipeMeta` to 
DataNode (blocking)
   2. DataNode's `createDataRegion` handler → `PipeConsensusServerImpl` 
constructor → synchronous `createPipe` RPC back to ConfigNode → blocked by the 
same lock → timeout
   
   ## Solution
   
   Delegate all consensus pipe lifecycle management to ConfigNode, eliminating 
DN→CN synchronous pipe RPCs entirely.
   
   **ConfigNode side:**
   - `AddRegionPeerProcedure`: add `CREATE_CONSENSUS_PIPES` state — creates 
bidirectional pipes between new peer and existing peers before 
`DO_ADD_REGION_PEER`
   - `RemoveRegionPeerProcedure`: add `DROP_CONSENSUS_PIPES` state — drops 
related pipes after `DELETE_OLD_REGION_PEER`
   - `RegionMaintainHandler`: add helper methods to build `TCreatePipeReq` and 
invoke `ProcedureManager.createConsensusPipe/dropConsensusPipe`
   
   **DataNode side:**
   - `PipeConsensusServerImpl`: remove `createConsensusPipes` call from 
constructor (pipes are created by ConfigNode's procedure)
   - `ConsensusPipeDataNodeDispatcher`: convert to no-op (all 4 methods just 
return immediately)
   
   **Consistency guarantees:**
   - New DataRegion creation: ConfigNode already creates pipes via 
`CreatePipeProcedureV2`
   - Region migration: ConfigNode creates pipes deterministically in procedure 
before coordinator starts data transfer
   - `checkConsensusPipe` guardian still detects inconsistencies via logging; 
`peerManager` updates are preserved through existing P2P notification flow


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