Files
seaweedfs/seaweed-block/internal/docs
Ping QiuandClaude Opus 5.5 2e204b533c fix(G1): persist the replica epoch floor across restarts (red test first) (#83)
* test(G1): red - a restarted replica applies a ship below its acknowledged epoch

fencing-gaps-todo.md G1, red test first, as the doc describes it: a
listener accepts a ship at epoch 2, is stopped and restarted on the same
store, and a ship at epoch 1 arrives. Today it is applied: the floor was
in memory only.

Adds the seam the fix uses: NewReplicaListenerWithFloor(addr, store,
floorPath), which cmd/blockvolume now uses with
<durable-root>/<volume-id>.replica-floor (empty for memback). floorPath
is ignored in this commit, so the test is red on behaviour.

Stacked on the G2 branch (it reuses G2's epoch floor).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(G1): a durable replica epoch floor, and no mutation before the role is known

fencing-gaps-todo.md G1, per the plan accepted on #83 (claude03; codex01
rounds 1-3).

- core/transport/floor.go: a versioned, volume-bound floor record,
  strictly decoded (unknown/duplicate/missing fields, trailing data, wrong
  schema or volume, over 4 KiB refuse); persisted by temp write+fsync,
  rename, directory fsync, each checked; InitReplicaFloor creates the
  bootstrap record (epoch 0) before the volume and never replaces one.
- Listener: NewReplicaListenerWithFloor(addr, store, volumeID, floorPath)
  loads the record (missing or invalid refuses) and starts unassigned:
  every mutating frame is refused until a role call succeeds. A frame
  whose epoch raises the floor persists it inside its G2-counted section
  before any effect or ACK (a barrier too); serialized under floorMu and
  monotonic; a refused frame leaves the lineage unchanged.
  FenceAsPrimary drains, persists, then returns; AdmitAsReplica persists
  first; both return the error.
- Host: AdmitAsReplica errors fail the supporting path closed; any failed
  role call sets an admission latch that makes the projection unhealthy
  (writes refuse even on a prior-healthy host), reported in /status;
  a later successful role call clears it. SetSelfFence returns the
  replay error and cmd/blockvolume then does not serve.
- cmd/blockvolume: the floor record is created before a new volume
  (DurableProvider.VolumeExists), and required on every later start.

Tests: the red test, revised to the accepted 3-phase form (epoch-2
barrier ACK; restart refused before assignment; a stale epoch-1
admission still refuses epoch 1; current epoch accepted), barrier-only
restart, fresh restart before assignment, record negatives and the
existing-empty missing-record refusal, per-step persist failures on
ship/barrier/rebuild, role-call persist failure incl. after a drain,
fence-then-crash, concurrent monotonic raises, probes never persist, and
the admission latch through the real StorageBackend. Each mechanism is
load-bearing: without persistence 5 tests fail, without the startup gate
2, without the latch 1. Ledger: INV-FENCE-FLOOR-DURABLE-001.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(G1): stale role replays never reconcile a newer failure; the floor record's key set is closed

codex01 review of 66446e0:
- R1: a stale successful role call (e.g. an epoch-2 replay after the
  epoch-3 persist failed) cleared the admission latch and reopened
  writes. The host's desired role is now monotonic in epoch: a role call
  below the current desired epoch is refused as stale, without
  replacing the desired role or touching the latch; only the current (or
  a newer) epoch's success clears it, and install replay targets the
  retained current role.
- R2: encoding/json struct decoding accepted case variants, so
  {"epoch":7,"EPOCH":0} loaded as floor 0. The key check now runs before
  decoding and accepts exactly schema, volume_id and epoch, case-sensitive,
  none repeated.

Red (66446e0's floor.go and host.go) / green: codex01's two controls;
the stale-replay cases on the primary, supporting and install-replay
paths; uppercase keys, case-folded duplicates in both orders and a
case-folded schema key refuse; canonical epoch 0 stays valid. All 23
G1/G2 tests pass 3/3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 08:44:36 -08:00
..

Internal Design Notes

This directory holds internal planning, audits, and decision-control notes.

Use this directory for documents that are useful to maintainers and coding agents but too detailed or process-heavy for public user documentation.

Public-facing docs belong in docs/.

Operating Rule

  • product-roadmap.md is the short global product plan.
  • current-plan.md is the active execution plan. Development should track this file.
  • When a current plan closes, move it under finished-plans/ with a phase/topic filename such as phase1_finishedplan_frontend_protocol_readiness.md, then create a new current-plan.md.
  • Long audits and historical plans live under ref/. They are references, not the day-to-day driver.
  • QA assignments live under qa-assignments/ and should be linked from current-plan.md with #QA.
  • Product spec gates live under ref/ and should be created or referenced before non-trivial P0/P1 implementation. Tests validate the spec; tests are not the spec.
  • When a plan closes, keep the finished markdown plan in finished-plans/. Link supporting audits, QA requests, and larger references from that plan under ref/ or qa-assignments/.

Current Index

File Purpose
product-roadmap.md Short global roadmap, product phases, and priority tracks.
current-plan.md Active development plan. Follow this first.
product-management-plan.md Older product goals, priorities, evidence links, and decision rules.
qa-assignments/ Concrete QA tasks with commands, pass criteria, and report templates.
finished-plans/ Closed phase/topic plans retained for PM history.
ref/product-spec-gate-template.md Cold spec-gate template for product semantics, non-negotiables, allowed simplifications, and drift checks.
ref/stage2-transparent-multipath-host-failover-spec.md Stage 2 product spec for iSCSI ALUA/dm-multipath Kubernetes host-path failover without pod recreate.
ref/node-loss-survival-mvp-spec.md Node-loss survival product spec: RF3 sync-quorum recovery across distinct Kubernetes nodes with non-loopback frontends.
ref/node-loss-lab-setup.md Lab setup note for the Node-Loss D3/D4 gates, including 3 Kubernetes nodes on 2 physical machines and physical-host disclosure.
ref/control-plane-observation-api-mvp.md Dashboard-grade read-only observation API spec: cluster status, volume timeline, event stream, and support-bundle UX.
finished-plans/phase1_finishedplan_frontend_protocol_readiness.md Historical iSCSI/NVMe protocol-readiness plan closed by the protocol release gate.
finished-plans/phase2_finishedplan_beta_hardening_seed.md Historical beta hardening seed plan.
finished-plans/phase3_finishedplan_beta_seed_stabilization.md Historical beta seed stabilization plan.
finished-plans/phase4_finishedplan_fast_gates_operations_contract_prep.md Historical fast-gates and operations contract prep plan.
finished-plans/phase5_finishedplan_read_only_operations_status_report.md Historical read-only operations status report plan.
finished-plans/phase6_finishedplan_iscsi_os_initiator_compatibility.md Historical iSCSI OS initiator compatibility plan closed by Linux and Windows validation.
finished-plans/phase7_finishedplan_iscsi_session_backend_pressure.md Historical iSCSI session/backend pressure plan closed by fast protocol, L2 restart, and Linux OS initiator gates.
finished-plans/phase8_finishedplan_main_merge_pr_readiness.md Historical main-merge readiness plan closed by PR #46 squash merge.
finished-plans/phase9_finishedplan_light_use_operations_mvp.md Historical light-use operations MVP plan closed by local CLI, bundle, and TestOps control-data validation.
finished-plans/phase10_finishedplan_light_use_install_lifecycle_operations_mvp.md Historical light-use install/lifecycle operations MVP plan closed by strict first-volume runbook and scenario validation.
finished-plans/phase11_finishedplan_cluster_ops_inventory_lifecycle_visibility_mvp.md Historical cluster operations inventory and lifecycle visibility MVP plan closed by strict multi-volume inventory validation.
finished-plans/phase12_finishedplan_product_owned_blockvolume_lifecycle_mvp.md Historical product-owned blockvolume lifecycle MVP plan closed by lifecycle ownership and scoped delete validation.
finished-plans/phase13_finishedplan_durable_volume_restart_reattach_mvp.md Historical durable volume restart/reattach MVP plan closed by RF=1 durable hostPath restart gates.
finished-plans/phase14_finishedplan_multi_node_attach_and_placement_mvp.md Historical same-node multi-node-capable attach and placement MVP plan.
finished-plans/phase15_finishedplan_basic_mounted_failover_and_reattach_mvp.md Historical RF=2 mounted app baseline plus controlled primary-failure safe-refusal plan.
finished-plans/phase16_finishedplan_stage1_mounted_recovery_ack_profile_mvp.md Historical Stage 1 mounted recovery ACK profile plan: RF=2 best-effort demo recovery and RF=3 sync-quorum beta recovery through CSI/pod recreate.
finished-plans/phase17_finishedplan_stage2_transparent_multipath_host_failover_mvp.md Historical Stage 2 transparent mounted failover plan: RF=3 sync-quorum iSCSI ALUA/dm-multipath recovery without pod recreate.
finished-plans/phase18_finishedplan_node_loss_survival_mvp.md Historical Node-Loss Survival plan: RF=3 sync-quorum Kubernetes-node-loss recovery through CSI/pod recreate on a surviving node.
finished-plans/phase19_finishedplan_control_plane_observation_ai_readable_ops_mvp.md Historical Control-Plane Observation plan: read-only master evidence API, AI-readable CLI export, product-owned event stream, and support-bundle evidence.
finished-plans/phase20_finishedplan_activation_day1_ops_mvp.md Historical Activation / Day-1 Ops plan: script-based v0.2 alpha install, first PVC, writer/reader checksum, read-only report, release note, and cleanup evidence.
ref/production-readiness-plan.md Longer readiness reference and iSCSI P1-P6 detail.
ref/light-use-block-storage-ux-research.md Comparison of Longhorn, OpenEBS, Rook/Ceph, Piraeus/LINSTOR, and EBS CSI light-user install/operations UX.
ref/blockvolume-lifecycle-ownership-contract.md Product-owned generated blockvolume workload lifecycle ownership contract for the current plan.
ref/iscsi-os-initiator-compat-plan.md Detailed iSCSI P1 OS-initiator compatibility plan and evidence.
ref/iscsi-v2-coverage-gap-audit.md V2-to-V3 iSCSI coverage gap audit and prioritized test backlog.
ref/v2-frontend-protocol-gap-audit.md Broader V2 frontend protocol feature gap audit.