mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
* V3 mini engine: Phase 01 + 02 + 03 initial implementation Phase 01 — Semantic Core (engine/): - 5 truth domains, 11 events, 6 commands, deterministic Apply() - Stale rejection, terminal truth, wrong-replica guard - 17 conformance tests Phase 02 — Reference Runtime (schema/ + runtime/ + conformance/): - YAML case loader with strict validation - Replay runner with expectation checker - 7 cases, 7 determinism proofs, 5 loader tests Phase 03 — Adapter (adapter/): - Single route: observation -> engine -> command -> executor - CommandExecutor with SetOnSessionClose callback - Command dispatch outside lock, session ID owned by adapter - 8 constraint tests (C8/C9/C10/C12 + callback + full route) 44 tests total, all passing. * Phase 04: runnable block sparrow with real TCP transport First public runnable slice of seaweed-block. Demonstrates three recovery paths end-to-end through a deterministic semantic engine: 1. Healthy: replica caught up (R >= H), no recovery needed 2. Catch-up: short gap (R >= S, R < H), ship blocks via TCP 3. Rebuild: long gap (R < S), full base copy via TCP Package structure (renamed v3mini/ -> core/): core/engine - deterministic Apply(state, event) reducer core/adapter - single-route adapter with async callback wiring core/schema - YAML conformance case loading (strict fields) core/runtime - replay runner for conformance oracle core/conformance - 7 YAML cases + determinism + loader tests core/storage - in-memory block store with LSN tracking core/transport - TCP protocol, replica listener, block executor cmd/sparrow - runnable demo binary 51 tests, all passing. Sparrow runs via: go run ./cmd/sparrow Key design rules enforced: - Engine decides, executor executes (C12) - Same facts produce same decision (C8) - Timer only triggers probe, never recovery (C9) - No transport state in engine (C10, recursive reflect guard) - Terminal truth only from SessionClosedCompleted - Executor honors engine-issued targetLSN exactly - Session close callback wired from executor to adapter to engine - Command dispatch outside adapter mutex (no deadlock risk) - Rebuild uses AdvanceFrontier (no LBA 0 corruption) - Catch-up reports barrier-confirmed achievedLSN, not intent * fix: address CodeRabbit/Gemini review findings 1. Max payload limit in ReadMsg (16MB cap, prevents memory exhaustion) 2. Session ID race fix: capture IDs under lock in buildSessionEvents, pass via map to executeCommand — no re-locking needed 3. Barrier response error handling in replica listener 4. Demo 1 uses waitForMode polling instead of fixed sleep 5. ApplyEntry validates data size matches blockSize 6. Rebuild test timing: small delay for replica Sync after MsgRebuildDone