mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
docs: bind pressure progress to durability and lifetime invariants
This commit is contained in:
1 parent
08d6f82903
commit
bb17d7a835
2 files changed
+78
No files matched your search
@@ -238,3 +238,42 @@ func TestWALStoreV3PressureProgressWithPendingCutOrClose(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWALStoreV3FlushBatchCacheIsBoundToRecoveryLifetime(t *testing.T) {
|
||||
s, err := createMappedWALStoreV3ForTest(filepath.Join(t.TempDir(), "volume"), 32, 4096, 64*1024, WModeStrict, 4)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() { _ = s.Close() })
|
||||
s.DisableAutoFlushForRecoveryTest()
|
||||
if _, err := s.WriteBatch(0, [][]byte{blk(1), blk(2), blk(3), blk(4)}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := s.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
e := s.dm.snapshot()[0]
|
||||
cache := &flushRecordCacheV3{recoveryGen: s.v3.recoverGen.Load()}
|
||||
if _, _, err := s.flusher.readDirtyRecordV3Cached(e, cache); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
before := s.FlusherInstrumentation()
|
||||
if err := s.flusher.flushOnce(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
after := s.FlusherInstrumentation()
|
||||
if got := after.WALRecordDecodeOps - before.WALRecordDecodeOps; got != 1 {
|
||||
t.Fatalf("four-block batch decoded %d times, want1", got)
|
||||
}
|
||||
for i := uint32(0); i < 4; i++ {
|
||||
if got, err := s.Read(i); err != nil || !bytes.Equal(got, blk(byte(i+1))) {
|
||||
t.Fatalf("batch read%d: %v", i, err)
|
||||
}
|
||||
}
|
||||
if _, err := s.Recover(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, _, err := s.flusher.readDirtyRecordV3Cached(e, cache); !errors.Is(err, ErrMapCoverageStale) {
|
||||
t.Fatalf("old recovery lifetime cache accepted: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -262,6 +262,45 @@ HEAD states, snapshots, forks, intents, key bindings, GC and volume delete in th
|
||||
|
||||
---
|
||||
|
||||
### Local WAL-pressure durability progress
|
||||
|
||||
A serving v3 store at the soft WAL watermark may perform an internal local
|
||||
sync from its existing flusher, before snapshotting dirty work. This transition
|
||||
uses the ordinary A/C physical-sync and final fault gate under one `syncMu`
|
||||
interval; it takes neither `captureMu` nor `lifecycleMu`. It is ineligible while
|
||||
BASE is installing or the store is closed. The leader is released before extent,
|
||||
map and checkpoint publication. Client Flush acknowledgements keep their own
|
||||
covering durability and observer requirements. Recovery invalidates the existing
|
||||
snapshot lifetime; local persistence does not bypass it.
|
||||
|
||||
- `INV-WAL-V3-PRESSURE-001`: I1, within a recovery/reset lifetime `wack` advances
|
||||
only after covering local persistence; I2, checkpoint remains at most `wack`
|
||||
and the active-session pin floor; I3, record reuse remains below the durable
|
||||
checkpoint, both-slot floor and dirty-reference retirement; I4, with healthy
|
||||
local progress and no guest Sync, the reuse floor advances. Enforced by
|
||||
`syncWALBatchV3Internal`, `persistOwnedMapCheckpointV3` and the existing reclaim
|
||||
publisher. Tests: `TestWALStoreV3NoClientSyncSixRings`,
|
||||
`TestWALStoreV3PressureSyncFaultDoesNotPublishFrontiers`,
|
||||
`TestWALStoreV3PressureSyncSkipsInstalling`,
|
||||
`TestWALStoreV3PressureProgressWithPendingCutOrClose` and
|
||||
`TestWALStoreV3PressureWaitBudgetAndPin`. Model correspondence/receipt is pending
|
||||
the parallel LIGHT internal-sync/reclaim liveness review; no model PASS is
|
||||
claimed by this source change.
|
||||
- The v3 pressure admission budget is four seconds of cooperative waiting. It
|
||||
cannot preempt a blocking occupancy/closed callback, lock acquisition or
|
||||
physical file I/O. An unresolved pin or local stall returns
|
||||
`ErrWALPressureTimeout`, preserved as `frontend.ErrBackendBusy`; NVMe returns
|
||||
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.
|
||||
- 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
|
||||
generation and cannot publish or materialize after that lifetime changes.
|
||||
`TestWALStoreV3FlushBatchCacheIsBoundToRecoveryLifetime` covers one batch decode
|
||||
and refusal after Recover. Missing map coverage still forbids checkpoint
|
||||
advancement; the earlier unmapped dark fixture is not a production geometry.
|
||||
|
||||
## Part B. Invariant ledger
|
||||
|
||||
80 rows: 69 ACTIVE, 11 STUB; 15 kept from the internal ledger, 65 new.
|
||||
|
||||
Reference in new issue
Block a user