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
+1 -3
View File
@@ -183,7 +183,7 @@ func findValidOffset(filePath string) (int64, error) {
break
}
rec, consumed, err := DecodePhysicalRecord(blockData[pos:])
_, consumed, err := DecodePhysicalRecord(blockData[pos:])
if err != nil {
// Corruption starts here — offset is up to last valid record.
validOffset = blockStartOffset + int64(pos)
@@ -192,8 +192,6 @@ func findValidOffset(filePath string) (int64, error) {
// Valid record found.
validOffset = blockStartOffset + int64(pos+consumed)
// Keep the rec reference alive so the compiler doesn't optimize it away.
_ = rec
pos += consumed
}