feat(wal): implement WAL writer with group commit and recovery batch replay

- wal/commit_queue.go: bounded buffered channel for write requests
- wal/writer.go: single-goroutine main loop implementing 11-step write flow
  with group commit, sequence allocation, MemTable publish/abort, write-stopped
- wal/recovery.go: BatchReplayer interface, ReplayBatch, ReplaySegmentFile,
  RecoverFromSegments with fragment reassembly and tail corruption handling
- Comprehensive tests for all modules, all pass with -race
This commit is contained in:
dailz
2026-06-12 13:57:31 +08:00
parent 08960a9bcf
commit fe2d4fc5f0
7 changed files with 971 additions and 4 deletions
+2 -2
View File
@@ -1009,7 +1009,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (with Task 13)
- [ ] 13. Commit queue + WAL writer main loop
- [x] 13. Commit queue + WAL writer main loop
**What to do**:
- 创建 `wal/commit_queue.go``CommitQueue` — 写请求队列
@@ -1233,7 +1233,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (with Tasks 16, 17)
- [ ] 16. WAL recovery: fragment collector + batch replay
- [x] 16. WAL recovery: fragment collector + batch replay
**What to do**:
- 创建 `wal/recovery.go`:恢复核心逻辑