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:
+1
-3
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user