Skip to content

[module][task] sharding: Install snapshots for lagging Raft followers #8348

Open

Description

@makr-code

Metadaten

  • Labels: type:feature, area:sharding, priority:medium, status:open
  • Milestone: v3.0.0 M2 by 2027-06-30 (production HA profile)
  • Status: open
  • Link zur Gesamtstatus-Tabelle: ROADMAP.md
  • Issue-Key: sharding-raft-snapshot-installation

Gesamtstatus

The Raft peer transport supports authenticated RequestVote and AppendEntries, but a follower whose next index is at or behind a compacted snapshot boundary cannot install that snapshot and resume replication. This remains an M2 multi-node recovery gate.

Kurzbefund

RaftConsensus::buildReplicationRequest() detects when a follower requires snapshot installation and returns an explicit failure; no Raft snapshot install RPC or receiver-side durable installation path is present. The limitation is documented in src/sharding/ROADMAP.md and src/sharding/API.md. Closed #3939 covers earlier snapshot compaction work, but does not establish this current Raft transport/install behavior.

Scope

  • Module: sharding
  • Files: src/sharding/raft_consensus.cpp, src/sharding/raft_log.cpp, src/sharding/shard_rpc_client.cpp, src/sharding/shard_rpc_server.cpp, Raft RPC protobuf definitions, focused sharding tests, and related module docs
  • Status: open
  • Documentation: Existing API and roadmap entries state the gap; link this issue from both and keep the acceptance boundary synchronized.

Source Evidence

  • Module docs: src/sharding/API.md, src/sharding/ROADMAP.md, src/sharding/FUTURE_ENHANCEMENTS.md
  • Source graph / symbol evidence: RaftConsensus::buildReplicationRequest(), RaftConsensus::replicateToFollower(), RaftLog::compactUpTo(), shard RPC AppendEntries client/server handlers
  • Doxygen artifact: Not applicable; no generated artifact was used as evidence.
  • Compliance report: Not applicable.

Acceptance Criteria / Copilot Tasks

  • Define a bounded Raft snapshot-install request/response contract and wire it through the shard RPC client/server; preserve verified mTLS peer identity, logical-group membership checks, request deadlines, and configured size limits.
  • When a follower's next_index is at or behind the leader's compacted snapshot index, transfer and verify the snapshot, then resume bounded AppendEntries replication after the installed index.
  • Validate snapshot group, included index/term, format/version, total size, chunk ordering, and integrity before installation; stage and durably install atomically so an interrupted, corrupt, stale, or unauthorized transfer leaves the prior follower state intact.
  • Advance follower progress and acknowledge installation only after durable installation; ensure the restored Raft state and retained log prefix are consistent for subsequent elections and replication.
  • Add focused unit and multi-process regressions for catch-up after compaction and follower restart, plus interrupted/corrupt/out-of-order chunks, identity/group mismatch, stale term, timeout, size-limit rejection, and no-state-change-on-failure.
  • Update the sharding API, roadmap, and operational documentation with the supported transfer behavior and explicit failure semantics; report only executed build/test evidence.
  • Run the focused Raft and gRPC/multi-process tests on a supported Linux build and retain the actual CI/test evidence before closing this gate.

Validation

  • Repro command: not yet available; create it with the focused test that compacts the leader log before a follower catches up.
  • Gate check: focused Raft snapshot-install test and existing sharding transport tests.
  • Success condition: a lagging follower durably reaches the leader's committed snapshot/log prefix and continues AppendEntries; all invalid or interrupted transfers fail closed without modifying installed state.

Merge Gate

  • Merge erst nach vollstaendig erfuellen Akzeptanzkriterien und Maintainer-Freigabe.

Notes

  • Risk/constraint: This is separate from application-level shard snapshot export and from WAL shipping; neither proves Raft follower snapshot installation.
  • Ownership/path rule: Keep implementation within the sharding module and existing public/private boundaries; do not introduce simulation or compatibility paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:shardingpriority:mediumstatus:opentype:feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions