fix: address Final Verification Wave findings

- Sync() now flushes BlockWriter before fd.Sync() for durability
- Pre-validate encoding before sequence allocation (design doc compliance)
- Remove dead _ = rec assignment in recover.go
- Remove unused maxPayload field from SegmentWriter
- Handle Put error in MemTable.Publish with panic on invariant violation
This commit is contained in:
dailz
2026-06-12 14:29:53 +08:00
parent 5905dbc06f
commit b833a21848
5 changed files with 100 additions and 10 deletions
+6
View File
@@ -145,6 +145,12 @@ func (ww *WalWriter) processBatch(requests []*CommitRequest) {
return
}
// Pre-validate encoding can succeed before sequence allocation.
if _, err := EncodeWalBatch(0, entries); err != nil {
ww.sendError(requests, err)
return
}
baseSequence, err := ww.seqManager.AllocateBatch(uint32(len(entries)))
if err != nil {
ww.sendError(requests, err)