mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
* 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>
6.1 KiB
6.1 KiB
Invariant Ledger
This ledger tracks current Seaweed Block protocol claims that must remain testable. It follows the V3 rule:
An invariant without a test is a wish, not an invariant.
Rows are append-only. If a row is retired, archive it with a reason instead of deleting it.
Status
ACTIVE: test exists and has been run for the current claim.STUB: row exists but a test/gate must still be added before release.ARCHIVED: retired or superseded.
Current Rows
| ID | Statement | Owner Layer | Test / Evidence | Status |
|---|---|---|---|---|
INV-AUTH-ONE-PRIMARY-001 |
A volume has at most one current primary after promotion; promotion evidence must report post_failure_primary_count=1. |
authority / master | Stage 1 RF3 recovery, Stage 2 D4, Node-Loss D4 bundles | ACTIVE |
INV-FENCE-STALE-PRIMARY-001 |
A stale primary cannot ACK post-failure writes after authority moves or target is stopped. | frontend + authority | Stage 2 D4 old_primary_stale_io_success_count=0; node-loss D4 stale-primary evidence |
ACTIVE |
INV-PROMOTE-FRONTIER-001 |
A replica is promotion-eligible only when it covers the required durable frontier for the active ACK profile. | recovery + durable | RF3 sync-quorum promotion-ready and recovery gates | ACTIVE |
INV-CSI-CONSUMES-AUTHORITY-001 |
CSI consumes the current publish target from master; CSI must not mint authority or choose a primary. | CSI + master API | Control-plane observation D5 csi_reattach_observed event with master-minted event ID |
ACTIVE |
INV-K8S-NONLOOPBACK-001 |
Cross-node Kubernetes attach must not publish loopback targets; multi-node values must enable external iSCSI/status. | K8s adaptor / Helm | Node-loss D3/D4, Helm multi-node first-volume, generate-helm-values CLI tests |
ACTIVE |
INV-OBS-PRODUCT-EVENTS-001 |
Product-owned event stream must include placement, promotion candidate evaluation, authority publication, and CSI reattach evidence for node-loss recovery. | observation / master | Control-plane observation close gate, cluster-evidence.json |
ACTIVE |
INV-HELM-RF-NODECOUNT-001 |
Generated Helm values fail closed when requested replication factor exceeds selected Ready schedulable node count. | Helm values generator | TestOpsGenerateHelmValuesRejectsRFAboveSelectedNodes |
ACTIVE |
INV-HOSTPATH-TRANSPARENT-001 |
Transparent failover claim requires same pod UID, host path switched to promoted target, stale primary fenced, one primary, and post-failure checksum. | host path + authority + workload | Stage 2 D4 mounted-failover close report | ACTIVE |
INV-K8S-REATTACH-001 |
Kubernetes node-loss recovery claim through pod recreate requires CSI re-stage to promoted frontend and reader checksum verification. | K8s adaptor + CSI + authority | Node-Loss Survival D4 run 20260516-160306-1e54 |
ACTIVE |
INV-MANAGED-VOLUME-READMODEL-001 |
User-facing PVC/volume explanations must be derived from the ManagedVolume read model, not independently recomposed by CLI, dashboard, TestOps, CSI logs, or shell grep. | operations model | core/ops/managed_volume_model_test.go, core/ops/managed_volume_evidence_test.go, core/ops/observation_report_test.go |
ACTIVE |
INV-CONTROL-CONTEXT-001 |
Cross-layer explanations must be derived from facts/events, not reconstructed from TestOps-only grep order. Superseded in scope by INV-MANAGED-VOLUME-READMODEL-001 but retained for continuity. |
observation | Product event stream D5; Phase 22 bundle artifact replay tests in core/ops/managed_volume_artifact_test.go and core/ops/observation_bundle_test.go |
ACTIVE |
INV-K8S-ADAPTOR-FACTS-001 |
K8s adaptor must express PVC/PV/Pod/Node/CSI facts as typed facts with source, time, generation, and confidence before deriving recovery status. | K8s adaptor / future operator | PVC pending, mount-failure, image-pull, loopback, and node-loss reattach tests in core/ops/managed_volume_model_test.go and core/ops/managed_volume_artifact_test.go |
ACTIVE |
INV-HOSTPATH-FACTS-001 |
Host path adaptor must distinguish iSCSI session reachability, multipath path state, ALUA state, and workload data check before claiming transparent failover. | host path adaptor | Stage 2 transparent host-path projection and non-claim tests in core/ops/managed_volume_model_test.go plus artifact replay in core/ops/managed_volume_artifact_test.go |
ACTIVE |
INV-FENCE-SELF-ON-PROMOTE-001 |
A primary at epoch e applies no inbound replication traffic (ship, recovery lane start, rebuild), and no traffic below e; it still answers probes, and its epoch floor never goes down when it later supports another primary (fencing gap G2). | transport replica listener + volume host | core/host/volume/g2_self_fence_test.go (TestG2_PromotedHostRefusesShipFromDeposedPrimary: real Host.applyFact primary path + real listener); core/transport/g2_self_fence_test.go |
ACTIVE |
INV-FENCE-FLOOR-DURABLE-001 |
A replica never accepts mutating traffic below the highest epoch it has acknowledged or taken a role at, across restarts, and accepts none before its assignment is known; a role call whose floor cannot be made durable is not adopted and keeps the frontend unhealthy (fencing gap G1). | transport replica listener + volume host + blockvolume wiring | core/transport/g1_durable_floor_test.go: restart (TestG1_RestartedReplicaRefusesShipBelowItsAcknowledgedEpoch: epoch-2 barrier ACK, restart, refused before assignment, stale epoch-1 admission still refuses epoch 1), concurrent raises (TestG1_ConcurrentRaisesNeverLowerTheRecord), fence then crash (TestG1_RoleCallsPersistBeforeReturning), persist-failure, record and fresh-volume controls; core/host/volume/g1_admission_latch_test.go |
ACTIVE |
Add Row Checklist
When adding a row:
- Give it a stable ID.
- State one concrete behavior.
- Name the owner layer.
- Add the test or gate that proves it.
- If no test exists yet, mark
STUBand block release claims that depend on it.
Release Discipline
For each alpha/beta release candidate:
total rows:
active rows:
stub rows:
gates passed:
known deferrals:
No release note should claim behavior backed only by STUB rows.