feat(wal): implement batch codec, validation, and Arena allocator

- wal/batch.go: WalBatch encode/decode with FragmentCollector state machine
- wal/validate.go: ValidateBatchLimits with checked arithmetic
- memtable/arena.go: Arena allocator with 8-byte alignment and mutex
- Comprehensive tests for all modules, all pass with -race
This commit is contained in:
dailz
2026-06-12 13:27:17 +08:00
parent cf913b1d52
commit fede839eb6
8 changed files with 1014 additions and 5 deletions
+3 -3
View File
@@ -555,7 +555,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (group with Tasks 3, 4)
- [ ] 6. WAL Batch encode/decode + fragment collector
- [x] 6. WAL Batch encode/decode + fragment collector
**What to do**:
- 创建 `wal/batch.go``WalBatch` 结构体(Flags uint16, BaseSequence uint64, EntryCount uint32, EntriesSize uint32, Entries []byte
@@ -633,7 +633,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (group with Task 9)
- Message: `feat(wal): implement WAL batch codec and resource validation`
- [ ] 7. Arena allocator
- [x] 7. Arena allocator
**What to do**:
- 创建 `memtable/arena.go``Arena` 结构体
@@ -759,7 +759,7 @@ Max Concurrent: 6 (Wave 1b)
**Commit**: YES (with Task 7)
- [ ] 9. WAL Batch resource validation
- [x] 9. WAL Batch resource validation
**What to do**:
- 创建 `wal/validate.go``ValidateBatchLimits(entries []*WalEntry, cfg *config.WalConfig) error`