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:
@@ -2,6 +2,7 @@ package memtable
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
@@ -114,7 +115,11 @@ func (mt *MemTable) Publish(upToSequence uint64) {
|
||||
|
||||
// Re-put each entry as published. Each call acquires the skiplist mutex.
|
||||
for _, e := range toPublish {
|
||||
_ = mt.skiplist.Put(e.key, e.value, e.sequence, false)
|
||||
if err := mt.skiplist.Put(e.key, e.value, e.sequence, false); err != nil {
|
||||
// Reserve guaranteed space, so this should never happen.
|
||||
// If it does, it's an internal invariant violation.
|
||||
panic(fmt.Sprintf("memtable: Put failed after Reserve: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
// Update high-water mark after all entries are visible.
|
||||
|
||||
Reference in New Issue
Block a user