Skip to content

[IoTV2] Add ConfigNode-side consensus pipe guardian and remove deprecated DataNode-side checking#17277

Open
Pengzna wants to merge 4 commits intoapache:masterfrom
Pengzna:add-async-consensus-pipe-checker
Open

[IoTV2] Add ConfigNode-side consensus pipe guardian and remove deprecated DataNode-side checking#17277
Pengzna wants to merge 4 commits intoapache:masterfrom
Pengzna:add-async-consensus-pipe-checker

Conversation

@Pengzna
Copy link
Collaborator

@Pengzna Pengzna commented Mar 9, 2026

NOTE: This PR is genereated by Claude, I proposed the entire plans and prompts and have carefully reviewed this PR.

Summary

This PR introduces a periodic consensus pipe reconciliation mechanism on ConfigNode and removes the now-redundant detection-only checking logic on DataNode.

As a follow-up to #17233 (which delegated consensus pipe lifecycle management from DataNode to ConfigNode), DataNode-side checking only logged warnings like "should be created/dropped by ConfigNode" but never performed actual repairs. With ConfigNode now owning the full lifecycle, we add a proactive guardian on ConfigNode that can create missing pipes, drop unexpected pipes, and restart stopped pipes, then clean up the obsolete DataNode code.

Changes

1. ConfigNode: Add consensus pipe guardian (2bd1c26b)

  • PipeMetaSyncer: Added a consensusPipeCheckRoundCounter that triggers checkAndRepairConsensusPipes() every 5 sync rounds.
  • PipeTaskCoordinator / PipeTaskInfo: Added getConsensusPipeStatusMap() to query all consensus pipe names and their current status from PipeMetaKeeper.
  • RegionMaintainHandler.checkAndRepairConsensusPipes(): The core reconciliation logic that:
    • Builds expected pipe set from PartitionManager replica sets (all node-pair permutations per DataRegion)
    • Compares against actual consensus pipes from PipeTaskInfo
    • Creates missing pipes asynchronously
    • Drops unexpected pipes asynchronously
    • Restarts stopped pipes

2. Unit tests (ff3d8e39)

  • PipeTaskInfoConsensusPipeTest: Tests getConsensusPipeStatusMap() — verifying filtering by pipe type (CONSENSUS vs USER vs SUBSCRIPTION), correct status mapping, and multi-region scenarios.
  • RegionMaintainHandlerConsensusPipeTest: Tests checkAndRepairConsensusPipes() with Mockito — covering no-op for non-IoTConsensusV2, all-pipes-match, create-missing, drop-unexpected, restart-stopped, mixed scenarios, and 3-node replica sets.

3. Remove deprecated DataNode-side code (5c93839b)

Deleted files:

  • ConsensusPipeDataNodeRuntimeAgentGuardian.java
  • ConsensusPipeGuardian.java (interface)
  • ConsensusPipeSelector.java (interface)

Cleaned up:

  • PipeConsensus.java — removed guardian field, checkAllConsensusPipe() method, and guardian start/stop calls
  • PipeConsensusServerImpl.java — removed checkConsensusPipe() method
  • PipeConsensusConfig.java — removed guardian, selector, and interval config from Pipe class and its builder
  • DataRegionConsensusImpl.java — removed guardian/selector/interval configuration
  • PipeDataNodeTaskAgent.java — removed getAllConsensusPipe() method

Test Plan

  • PipeTaskInfoConsensusPipeTest passes (5 test cases)
  • RegionMaintainHandlerConsensusPipeTest passes (7 test cases)
  • Existing IoTConsensusV2 integration tests (3C3D) still pass
  • Manual verification: deploy 3-node cluster with IoTConsensusV2, verify ConfigNode guardian detects and repairs missing consensus pipes

@Pengzna Pengzna changed the title [IoTV2] Add consensus pipe check to config node [IoTV2] Add ConfigNode-side consensus pipe guardian and remove deprecated DataNode-side checking Mar 9, 2026
@Pengzna Pengzna marked this pull request as ready for review March 9, 2026 11:56
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