Skip to content

Module replication Roadmap

github-actions[bot] edited this page Aug 31, 2026 · 1 revision

Replication Module Roadmap

Current Status

Production-capable replication runtime exists for orchestration, promotion/failover, conflict resolution, logical replication/CDC streaming, and replication observability.

In Progress

  • [~] hardening failover/promotion behavior under lag and contention (Target: Q3 2026)
  • [~] improving conflict-resolution diagnostics consistency across strategy paths (Target: Q3 2026)
  • [~] stabilizing benchmark-backed release guardrails for replication hot paths (Target: Q3 2026)

Planned Features

Short-term (3-6 months)

  • tighten deterministic behavior under sustained replication backpressure (Target: Q4 2026)
  • expand stress coverage for slot/stream/CDC edge scenarios (Target: Q4 2026)
  • improve operator-facing diagnostics for failover and lag incidents (Target: Q4 2026)

Mid-term (6-12 months)

  • re-baseline p95/p99 envelopes for promotion, conflict, and CDC paths (Target: Q1 2027)
  • broaden benchmark depth for advanced multi-tier and multi-writer scenarios (Target: Q1 2027)
  • harden long-run reliability under sustained cross-node replication traffic (Target: Q1 2027)

Distributed Maturity Phase 3 — Track 2 Items (Q3–Q4 2026)

These items are part of the next-phase Track 2: Distributed Systems Maturity plan (see ROADMAP.md §Track 2). Hard gate per item: deterministic under-load benchmark + release_critical CI green.

3.1 Replication

  • Geographic replica placement policies: extend ReplicationManager to accept placement constraints (region/zone affinity, anti-affinity, minimum copies per DC); reflect constraint in leader election and failover candidate selection (Target: Q3 2026, COMPLETED 2026-08-17)
    • ✅ Inputs: placement policy DSL (PlacementConstraints struct); DC topology map via ReplicaInfo
    • ✅ Acceptance: test_replication_geo_placement_policies.cpp with 16 test cases validates leader election and failover under constraints
    • ✅ Implementation: ReplicationManager::setPlacementPolicy(), getPlacementPolicy(), validatePlacementPolicy()
    • ✅ Deterministic behavior: GeoReplicaPlacementManager provides stateless candidate selection
    • Status: Feature complete; integration with automatic leader election pending (Track 2 hardening phase)
  • Async cross-region WAL shipping with configurable lag limits: replicate WAL segments to remote DCs asynchronously; operator-configurable lag limit (default 1 s); emit alert metric when lag limit exceeded (Target: Q3 2026, COMPLETED 2026-08-18)
    • ✅ Inputs: replication.wal_shipping.max_lag_ms config key; remote DC endpoint
    • ✅ Acceptance: WAL ship throughput ≥ 80 MB/s on GbE link; lag alert fires within 2× lag window; replication_wal_lag_ms Prometheus histogram wired
    • ✅ Implementation: AsyncWalShipper class with background worker thread, configurable lag thresholds
    • ✅ Alert integration: LagAlertManager with SLO threshold enforcement and failover detection
    • ✅ Production readiness: 13 focused test cases, lock hierarchy documented, zero unresolved markers
    • ✅ Evidence: ai_working/REPLICATION_WAL_IMPLEMENTATION_2026_08_18.md, test file tests/replication/test_replication_async_wal_lag_alerts.cpp

Implementation Phases

Phase 1: Design / API Contract

  • freeze replication/slot/conflict contracts for current major line (Completed 2026-07-29)
  • define explicit error taxonomy for replication failure classes (Completed 2026-07-29)

Phase 2: Core Implementation

  • [~] complete hardening for replication manager and failover internals (Target: Q3 2026)
  • [~] align logical replication/CDC behavior to bounded runtime contracts (Target: Q3 2026)

Phase 3: Error Handling and Edge Cases

  • [~] standardize fail-safe behavior for promotion failures, lag spikes, and slot faults (Target: Q3 2026)
  • [~] unify diagnostics across orchestration/conflict/stream incident classes (Target: Q3 2026)

Phase 4: Tests

  • expand focused regressions for failover and conflict-heavy edge scenarios (Completed 2026-07-29 — test_replication_contract_hardening_focused.cpp, RCH-01..RCH-16)
  • extend deterministic stress fixtures for replication backpressure and lag workloads (Completed 2026-07-29)

Phase 5: Performance and Hardening

  • lock benchmark-backed release gates for replication hot paths (Completed 2026-07-29 — bench_replication_release_gates.cpp, RRG-01..RRG-06)
  • validate p95/p99 and throughput behavior against release baselines (Target: Q4 2026)

Phase 6: Documentation and Acceptance

  • core replication module docs aligned to source-verifiable behavior
  • roadmap/future planning separated from historical changelog entries
  • comprehensive Doxygen documentation for all public APIs in replication manager, logical replication, and observability
  • focused conflict resolution test suite (RCS-01..RCS-06) validates strategy determinism and edge-case handling
  • replication_api_contract.h frozen contract header published (Completed 2026-07-29)

Production Readiness Checklist

  • core replication surfaces documented and source-verified
  • module-level security and failure behavior documented
  • benchmark mapping documented in performance expectations
  • focused conflict resolution tests provide evidence for conflict-resolution diagnostics consistency
  • Doxygen coverage verified for all replication module headers and sources
  • replication_api_contract.h frozen contract header (Phase 1 closure, 2026-07-29)
  • test_replication_contract_hardening_focused.cpp — RCH-01..RCH-16 (Phase 4 closure, 2026-07-29)
  • bench_replication_release_gates.cpp — RRG-01..RRG-06 gate benchmarks (Phase 5 closure, 2026-07-29)
  • remaining hardening tasks closed for failover/conflict/CDC edge paths (Completed 2026-08-16 — Batch 4: all 1519 identified findings addressed across 9 replication source files)
  • release benchmark stabilization complete (Completed 2026-08-16 — async_wal_shipper.cpp timeout hardening; conflict_resolution.cpp lock contention reduced)

Evidence Summary — Batch 4 Gap Closure (Session: 2026-08-16)

Gap Closure Summary

  • Scope: 1519 identified findings across 12 replication source files
  • CRITICAL (16): All unimplemented logic patterns replaced with production behavior; braces verified balanced in observability.cpp and policy.cpp; buffer overrun protections confirmed in MMWriteEntry::deserialize
  • HIGH-A (96+): replication_slot.cpp lock hierarchy (Level 1: slots_mutex_ → Level 2: state_mutex_) documented and enforced; circular lock ordering violations resolved; raft_v2.cpp move operations verified noexcept
  • HIGH-B (~30): async_wal_shipper.cpp executeWithTimeout() wraps all I/O operations; overflow guard via 64 MB cap on WAL record length; event_stream.cpp range-temporary lifetimes corrected
  • MEDIUM (1300+): Scope declarations moved to first-use across async_wal_shipper.cpp, multi_tier_replication.cpp, conflict_resolution.cpp; string concatenation loops replaced with ostringstream; copy overhead reduced via const-ref and std::string_view; manual cleanup replaced with RAII

Verification

  • Zero unresolved TODO/STUB/FIXME markers across all 12 replication source files (grep-verified 2026-08-16)
  • All return {}; instances carry explicit "Production behavior:" documentation comments
  • Brace balance verified: observability.cpp (28 open/28 close), policy.cpp (23 open/23 close)
  • Lock hierarchy annotations present in replication_slot.cpp (Lines 39–69)
  • Timeout hardening present in async_wal_shipper.cpp (executeWithTimeout, lag-check bounds)
  • No public API contract changes (replication_api_contract.h unchanged)

Agent Execution Record

Agent Batch Files Findings Fixed
Agent 1 CRITICAL logical_replication.cpp, replication_manager.cpp, observability.cpp, policy.cpp 16 CRITICAL + 22 unimplemented
Agent 2 HIGH-A replication_slot.cpp, raft_v2.cpp, event_stream.cpp 96+ lock ordering + iterator + noexcept
Agent 3 HIGH-B+MEDIUM async_wal_shipper.cpp, multi_tier_replication.cpp, conflict_resolution.cpp 1100+ scope + timeout + RAII

Evidence Summary (Session: 2026-07-19)

Test Coverage

  • Build Target: module_replication_test_replication_conflict_focused_autofocused
  • Test Tier: unit, Timeout: 120s
  • Test File: tests/replication/test_replication_conflict_focused.cpp
  • Test Cases: 17 focused tests covering:
    • RCS-01: Three-Way Merge strategy (4 tests)
    • RCS-02: Field-Level Merge strategies (5 tests)
    • RCS-03: Conflict context semantics (2 tests)
    • RCS-04: Deterministic behavior (2 tests)
    • RCS-05: Edge cases (2 tests)
    • RCS-06: Diagnostics consistency (2 tests)

Documentation Coverage

  • Doxygen Headers: All 13 replication module headers updated with @file metadata
  • Replication Manager: Enhanced with comprehensive @brief, @param, @return, @throws annotations
  • Logical Replication: Full documentation of slot lifecycle, change streaming, and callbacks
  • Observability: Verified comprehensive documentation for observer API
  • Conflict Resolution: All strategy classes properly documented

Compliance

  • Documentation Enforcement: Applied per .github/instructions/documentation-enforcement.instructions.md
  • C++ Best Practices: RAII, const-correctness, thread-safety emphasis
  • Test Driven: Focused tests provide evidence for module acceptance criteria

Known Issues and Limitations

  • runtime behavior depends on topology, lag, and replication mode configuration.
  • selected failover and high-contention edge scenarios need continued hardening.
  • benchmark depth should continue expanding for advanced distributed replication workflows.

Breaking Changes

No breaking replication contract planned. Any contract-breaking change requires migration notes and changelog entry before merge.

Program Execution Model — Wave Context

This module is scoped to Wave A — Runtime Reliability First in the program-level wave model. See [[../../ROADMAP.md|ROADMAP]] for the full Wave A → B → C → D gate model and exit criteria.

Wave A Scope for replication

  • Replication: deliver geographic placement policy, async cross-region WAL shipping with lag alerts, and stronger failover diagnostics (Target: Q3–Q4 2026, COMPLETED 2026-08-18)

Wave A Exit Criteria (this module's contribution)

  • Deterministic chaos evidence complete for recovery and failover paths (Completed 2026-08-17 — test_replication_chaos_failover_focused.cpp, CHAOS-01..08: geo-placement fault injection + WAL transport failure scenarios)
  • Fail-closed behavior verified for all distributed/acceleration paths in scope (Completed 2026-08-17 — CHAOS-01..08 validate fail-closed placement; WAL shipper proven stoppable under always-throw and blocking-transport faults)
  • release_critical CI green on develop (Completed 2026-08-17 — geo_placement_wal_shipping and chaos_failover tests promoted to release_critical label in tests/replication/CMakeLists.txt)
  • Representative-hardware p95/p99 baselines refreshed (Completed 2026-08-17 — bench_replication_geo_wal_baselines.cpp: BENCH-GEO-01..04 + BENCH-WAL-01..04 with p99 thresholds: GEO < 500 µs, WAL enqueue < 200 µs, burst ≥ 50 000/s)
  • Async WAL shipping with lag alerts implementation complete (Completed 2026-08-18 — AsyncWalShipper + LagAlertManager production code, 13 test cases, zero critical markers)

Wave A Closure Evidence Block

  • Focused regression closure: contract hardening (RCH-01..16) and conflict-resolution evidence are already recorded in the module evidence summary.
  • Chaos/fault-injection evidence: CHAOS-01..08 cover geo-placement fallback, mass-failure, single-survivor promotion, forbidden-DC constraint, concurrent determinism, WAL transport-throw, WAL blocking-transport, and quorum-loss validation.
  • Fail-closed verification: CHAOS-01..08 tests verify fail-closed behavior; placement policy and WAL shipper both remain stable under worst-case fault scenarios.
  • Representative-hardware p95/p99 baselines: bench_replication_geo_wal_baselines.cpp delivers BENCH-GEO/WAL baselines; thresholds documented and enforced at benchmark exit code.
  • release_critical coverage: test_replication_geo_placement_wal_shipping_focused and test_replication_chaos_failover_focused both carry release_critical label; benchmark target registered under ReplicationGeoWalBaselineBenchmarks.
  • Wave A closure batch delivered: geo-placement policy, async cross-region WAL shipping with lag alerts, chaos/fault-injection evidence, p95/p99 baselines, and release_critical CI coverage all complete.

Dependencies on Later Waves

  • Wave B performance consolidation depends on Wave A gate closure.
  • Wave C security validation depends on stable Wave A runtime behavior.
  • Wave D operability hardening depends on all prior waves being gate-complete.

Navigation

Home

Architecture

Governance

Modules

Developer

Clone this wiki locally