docs: bind frontend retry mapping to its approved invariant

This commit is contained in:
pingqiu committed 2026-11-22 02:00:11 -08:00
1 parent a46a355f07
commit 5508d581b5
4 files changed
+14 -5

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import (
"errors"
)
// BackendErrorClass is independent of the transport's status codes.
// BackendErrorClass is independent of transport status (INV-FE-ERROR-RETRY-CLASS-001).
type BackendErrorClass uint8
const (
@@ -16,7 +16,7 @@ const (
BackendErrorClosed
)
// ClassifyBackendError implements the approved r2.36 frontend retry-class rule.
// ClassifyBackendError implements INV-FE-ERROR-RETRY-CLASS-001.
// Call only for a non-nil backend error. A pure expired command deadline is
// transient; a joined physical cause keeps its permanent classification.
func ClassifyBackendError(ctx context.Context, err error) BackendErrorClass {
@@ -22,7 +22,7 @@ func (b classifiedErrorBackend) Read(context.Context, int64, []byte) (int, error
func (b classifiedErrorBackend) Write(context.Context, int64, []byte) (int, error) { return 0, b.err }
func (b classifiedErrorBackend) Sync(context.Context) error { return b.err }
// r2.36: transient backend errors must never become a media failure. Both
// INV-FE-ERROR-RETRY-CLASS-001: transient backend errors must never become a media failure. Both
// protocol handlers consume the same backend condition; neither returns data.
func TestBackendErrorClassesAcrossFrontends(t *testing.T) {
for _, tc := range []struct {
@@ -17,7 +17,7 @@ func (b retryClassBackend) Read(context.Context, int64, []byte) (int, error) {
func (b retryClassBackend) Write(context.Context, int64, []byte) (int, error) { return 0, b.err }
func (b retryClassBackend) Sync(context.Context) error { return b.err }
// r2.36: validate the completion encoding, not only the handler's status code.
// INV-FE-ERROR-RETRY-CLASS-001: validate the completion encoding, not only the handler's status code.
func TestBackendRetryClassClearsWireDNR(t *testing.T) {
for _, tc := range []struct {
name string
+10 -1
View File
@@ -376,6 +376,14 @@ snapshot lifetime; local persistence does not bypass it.
Generic/Namespace Not Ready (SC0x82), DNR=0. Sticky faults retain their original
non-retryable mapping. This is a local pressure outcome, not a whole-I/O
deadline; the broader budget gap is tracked separately in issue221.
- Every frontend I/O error completion uses one shared retry class
(`INV-FE-ERROR-RETRY-CLASS-001`): not-ready and pure expired-command
deadlines map to SCSI NOT READY04/01 or NVMe NamespaceNotReady/DNR0;
local busy maps to SCSI BUSY or NVMe NamespaceNotReady/DNR0. Stale
lineage and closed preserve their distinct path-status meanings.
Permanent errors retain terminal protocol mapping, including a deadline
joined with a physical error. Read, write and sync use the same classifier;
no storage/authority state changes on this mapping.
- A flusher cycle sorts native snapshot entries by record offset and reuses at
most one fully validated record (bounded by WALSize). Every block still checks
its LBA/data offset/LSN/nonce; the cache is local to the snapshot recovery
@@ -410,7 +418,7 @@ Tests: `TestSnapshotSchedule_SlotsAreOffsetPerVolume`, `_FailureIsTypedAndBacksO
## Part B. Invariant ledger
303 rows: 217 ACTIVE, 83 STUB, 3 ARCHIVED; 15 kept from the internal ledger, 288 new.
304 rows: 218 ACTIVE, 83 STUB, 3 ARCHIVED; 15 kept from the internal ledger, 289 new.
The "Machine / transition" column refers to Part A. Notes under a table record what a row does not cover and, for kept rows, what was narrowed from the internal ledger.
@@ -455,6 +463,7 @@ The "Machine / transition" column refers to Part A. Notes under a table record w
| `INV-WAL-V3-ADMISSION-EXPIRY-STATE-001` | A v3 write refused for an expired deadline before its append leaves the WAL bytes, nextLSN and the dirty map unchanged. | M1 Serving (write admission) | `core/storage/walstore.go` `WALStore.WriteContext`, `WALStore.WriteBatchContext` | `TestStorageBackendExpiredWriteDoesNotAppend` | — | ACTIVE |
| `INV-WAL-V3-ADMISSION-PREFIX-ERR-001` | A write batch that returns a committed prefix with a storage error keeps that error in the error set the frontend classifies. | M1 Serving (write admission) | `core/frontend/durable/storage_adapter.go` `writeFullBlockBatch`, `withStorageCause`, `observeWriteCause` | `TestStorageBackendPartialBatchPhysicalFaultSurvivesObserverDeadline` | — | ACTIVE |
| `INV-WAL-V3-ADMISSION-RETRYABLE-001` | A write that fails only because the caller's deadline expired is reported retryable, also through a required write observer and on NVMe; a write whose error carries a physical cause is reported terminal. | M1 Serving (write admission) | `core/frontend/write_budget.go` `IsWriteDeadline`; `core/frontend/durable/storage_adapter.go` `StorageBackend.Write`, `replicationWriteError`; `core/frontend/nvme/io.go` `mapBackendError`; `core/frontend/nvme/session.go` `Session.handleWrite` | `TestStorageBackendRequiredObserverDeadlineStaysRetryable`, `TestStorageBackendPartialBatchPhysicalFaultSurvivesObserverDeadline`; `TestSessionWriteBudgetDeadlineIsRetryableIncludingFUA` (`core/frontend/nvme/write_command_budget_test.go`) | — | ACTIVE |
| `INV-FE-ERROR-RETRY-CLASS-001` | A backend error's retry class is decided once and every frontend reports it with its protocol's retryable form; only permanent errors become medium errors. | M1 I/O error completion (shared frontend classifier) | `core/frontend/error_class.go` `ClassifyBackendError`; `core/frontend/iscsi/scsi.go`, `core/frontend/nvme/io.go` `mapBackendError` | `TestBackendErrorClassesAcrossFrontends` (`core/frontend/iscsi/backend_error_class_test.go`); `TestBackendRetryClassClearsWireDNR` (`core/frontend/nvme/backend_error_class_test.go`); `TestSessionWriteBudgetDeadlineIsRetryableIncludingFUA` (`core/frontend/nvme/write_command_budget_test.go`) | Protocol output only; existing backend states, no new automaton state | ACTIVE |
| `INV-WAL-V3-RECLAIM-001` | A mapped v3 checkpoint at cp moves retainedTail only to the end of a complete validated record whose last LSN is at most cp minus the retention window, and, while a BASE is installing, never past BaseCursor. | M1 checkpoint / existing two-slot retirement | `core/storage/walstore_map_checkpoint_v3.go` `WALStore.publishCheckpointV3`; `core/storage/wal_io_v3.go` `walWriterV3.reclaimThroughV3` | `TestWALStoreV3CheckpointReclaimsAcrossRingLaps`, `TestWALStoreV3ReclaimKeepsPartialBatchAndRetention`, `TestWALStoreV3ReclaimAfterInstallingPhysicalReopen` | Existing dual-slot retirement and nonce/cursor contract; concrete index/recovery/caller wiring is a code-test obligation | STUB |
| `INV-WAL-V3-RECLAIM-INDEX-001` | A physical v3 recovery rebuilds the writer's volatile record-boundary index only from trusted write records of the kept scan; an installing reopen indexes them without moving the writer's cursor. | M1 checkpoint / existing two-slot retirement | `core/storage/wal_io_v3.go` `walWriterV3.restoreScanV3`, `walWriterV3.rememberReclaimScanV3`, `walWriterV3.indexReclaimScanLockedV3`; `core/storage/walstore_v3.go` `WALStore.recoverV3` | `TestWALStoreV3ReclaimRebuildsIndexAfterPhysicalRecovery`, `TestWALStoreV3ReclaimAfterInstallingPhysicalReopen` | — | STUB |
| `INV-WAL-V3-RECLAIM-PUBLISH-001` | A mapped v3 checkpoint publishes retainedTail, retainedHead, the map root, CheckpointLSN and W in one slot publication, followed by a metadata-only rollover when the fallback slot still pins a lower tail. | M1 checkpoint / existing two-slot retirement | `core/storage/walstore_map_checkpoint_v3.go` `WALStore.publishCheckpointV3`; `core/storage/descriptor_v3.go` `descriptorPublisherV3.rolloverIfPinned` | `TestWALStoreV3CheckpointReclaimsAcrossRingLaps`, `TestWALStoreV3ReclaimSecondSlotFailureKeepsOldPin` | — | STUB |