mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
storage: refuse regressed frontiers before streaming payloads
This commit is contained in:
1 parent
9da685d89e
commit
48b4c0cc18
2 files changed
+16
-11
No files matched your search
@@ -889,6 +889,17 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch
|
||||
// Do not sample the owned map after COW writers are admitted again.
|
||||
births := l.captureBirths(candidates, h)
|
||||
|
||||
if h < baseHead.RemoteLSN && !l.supersededBy(baseHead) {
|
||||
l.s.captureMu.Unlock()
|
||||
st.BarrierPauseNs = time.Since(pauseStart).Nanoseconds()
|
||||
// HEAD holds the image of a later LSN than this host's log has
|
||||
// reached: publishing would move remote_lsn backwards. Refused
|
||||
// before any upload. (A HEAD of a newer holder fences below.)
|
||||
l.abortCut(all)
|
||||
l.dropIntents(ctx, intents)
|
||||
return chunkCutResult{}, fmt.Errorf("%w: %w: cut LSN %d, HEAD remote_lsn %d", errChunkCaptureRefused, errChunkLSNBehind, h, baseHead.RemoteLSN)
|
||||
}
|
||||
|
||||
st.CandidateChunks = len(candidates)
|
||||
var copyErr error
|
||||
copyStart := time.Now()
|
||||
@@ -943,14 +954,6 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch
|
||||
if b := l.cfg.BarrierBound; b > 0 && st.BarrierCopyChunks > b {
|
||||
st.BarrierOverBound = true
|
||||
}
|
||||
if h < baseHead.RemoteLSN && !l.supersededBy(baseHead) {
|
||||
// HEAD holds the image of a later LSN than this host's log has
|
||||
// reached: publishing would move remote_lsn backwards. Refused
|
||||
// before any upload. (A HEAD of a newer holder fences below.)
|
||||
l.abortCut(all)
|
||||
l.dropIntents(ctx, intents)
|
||||
return chunkCutResult{}, fmt.Errorf("%w: %w: cut LSN %d, HEAD remote_lsn %d", errChunkCaptureRefused, errChunkLSNBehind, h, baseHead.RemoteLSN)
|
||||
}
|
||||
|
||||
// Upload only what changed against HEAD.
|
||||
next := copyHead(baseHead)
|
||||
|
||||
@@ -191,12 +191,14 @@ stateDiagram-v2
|
||||
Stage --> Quiesce: at most 3 pre-copy rounds
|
||||
Quiesce --> OpenWindow: Sync H and D fixed under barrier
|
||||
OpenWindow --> Copy: release barrier
|
||||
Copy --> Closed: all candidates done
|
||||
Copy --> Upload: local entry released, intent durable first
|
||||
Upload --> Copy: next unsent candidate
|
||||
Upload --> Closed: all workers settled
|
||||
Copy --> Aborted: error, cancellation, observed fence, recovery or close
|
||||
Upload --> Aborted: error, cancellation, observed fence, recovery or close
|
||||
Aborted --> Refused: drain owners, cleanup, merge candidates
|
||||
Copy --> Refused: H below HEAD RemoteLSN
|
||||
Closed --> Upload: drain and cleanup; intent durable first
|
||||
Upload --> Manifest
|
||||
Closed --> Manifest: drain owners and cleanup
|
||||
Manifest --> Readmit
|
||||
Readmit --> Fenced: superseding HEAD
|
||||
Readmit --> CAS
|
||||
|
||||
Reference in new issue
Block a user