mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
storage: detect WAL holes; walstore warns, smartwal fails closed
Issue #51, claude05's rulings (2026-11-16 06:10Z, 06:14Z). walstore (interim; no fail-closed: a plain power loss must never become an outage): - recovery decodes every range first and replays by LSN, not by scan order (a persisted head/tail can predate a wrap). A non-zero bad entry bounds the replay: its LSN is above its circular predecessor's, so nothing at or above that bound is replayed in any range. - a bad entry followed by any valid later entry is a suspected hole: logged, counted (HolesSuspected) and reported as the typed warning wal_hole_suspected (WALStore.RecoveryWarnings), surfaced in the durable status and on /status without changing Healthy or readiness. - trailing zeros still just end a range; a torn tail recovers silently. smartwal: a corrupted committed slot (magic present, record CRC bad) behind the highest valid LSN's slot is a mid-history hole: WAL integrity failure (wal_corrupt). The slot right after it is the torn- tail position and still recovers. The durable synced watermark that tells a corrupted synced record from an unsynced torn one is the post-M4 format change, not this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d2a6a3b02c
commit
f8d43653a7
4 files changed
+2
-8
No files matched your search
@@ -277,7 +277,7 @@ func (b *StorageBackend) durableStatus(volumeID, path, impl string) VolumeStatus
|
||||
evidence, _ := b.opEvidence.Load().(string)
|
||||
var warnings []string
|
||||
var holes uint64
|
||||
if w, ok := b.storage.(storage.RecoveryWarner); ok && false { // RED: warnings not reported
|
||||
if w, ok := b.storage.(storage.RecoveryWarner); ok {
|
||||
warnings = w.RecoveryWarnings()
|
||||
}
|
||||
if c, ok := b.storage.(interface{ HolesSuspected() uint64 }); ok {
|
||||
|
||||
@@ -483,7 +483,7 @@ func (s *StatusServer) statusProjection() StatusProjection {
|
||||
p.FrontendPrimaryReady = p.FrontendPrimaryReady && !s.nvmePending
|
||||
src := s.durableSource
|
||||
s.mu.Unlock()
|
||||
if src != nil && false { // RED: /status carries no warnings
|
||||
if src != nil { // outside s.mu: the provider takes its own lock
|
||||
for _, st := range src.DurableStatuses() {
|
||||
if st.VolumeID == p.VolumeID {
|
||||
p.Warnings = append(p.Warnings, st.Warnings...)
|
||||
|
||||
@@ -243,9 +243,6 @@ func recoverWAL(fd *os.File, sb *superblock, dm *dirtyMap) (recoveryResult, erro
|
||||
}
|
||||
}
|
||||
}
|
||||
if red := true; red { // RED: no hole bound, no warning
|
||||
hole, holeLSN = false, ^uint64(0)
|
||||
}
|
||||
if hole {
|
||||
result.HoleSuspected = true
|
||||
result.HoleDetail = fmt.Sprintf("WAL entry at offset=%d fails its check and valid entries from LSN %d on follow it; recovered the entries below LSN %d", holeAt, holeLSN, holeLSN)
|
||||
|
||||
@@ -113,9 +113,6 @@ func runRecovery(r *ring, fd *os.File, extentBase int64, blockSize int) (uint64,
|
||||
// H's (d = capacity-1) is where LSN H+1 goes: a torn tail, which still
|
||||
// recovers; so is a slot whose implied LSN was never written.
|
||||
func midHistoryHole(bad []uint64, highest, capacity uint64) error {
|
||||
if red := true; red { // RED: a bad slot is always a torn slot
|
||||
return nil
|
||||
}
|
||||
if capacity < 2 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user