mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
chunkstore: verify: only a usable closing read completes a pass; one segment object per key
A closing read of HEAD that finds no HEAD, or one that does not decode, leaves the final view without a HEAD root and the result incomplete (head_absent, head_invalid); it no longer keeps the earlier view. A manifest segment is checked once per owner and key with one outcome, like a chunk; a root whose reference does not match the content gets one mismatch, and segment findings follow the one-per-key-and-class rule under the first root that names the key. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
b86dcf547d
commit
732941ff5a
4 files changed
+469
-111
No files matched your search
@@ -191,10 +191,16 @@ those outcomes and the roots at its final read:
|
||||
chunks it names that the pass has not seen are added and checked).
|
||||
- When every chunk is checked, verify reads HEAD and each checked snapshot's state
|
||||
once more. If that read names a chunk not seen, verify checks it and reads
|
||||
again, at most 3 times; the read that names nothing new is the final read.
|
||||
- A bad chunk is one finding, under the first root that names it at the final
|
||||
read (HEAD, then the snapshots still active, in order), at that root's first
|
||||
index for it. A bad chunk no root names then is not reported: it is counted in
|
||||
again, at most 3 times; the read that names nothing new is the final read, and
|
||||
no read follows it. Only a HEAD that decodes can be part of it: if that read
|
||||
finds no HEAD, or one that does not decode, the final view has no HEAD root and
|
||||
the pass is incomplete.
|
||||
- A segment is read once per key, whatever reference names it: a root whose
|
||||
reference matches its content uses it; a root whose reference does not has a
|
||||
`CONTENT_MISMATCH` for that segment.
|
||||
- A bad chunk (or segment) is one finding per class, under the first root that
|
||||
names it at the final read (HEAD, then the snapshots still active, in order), at
|
||||
that root's first index for it. A bad one no root names then is not reported: it is counted in
|
||||
`rootDeletedDuringVerify` when a checked snapshot that was deleted during the
|
||||
pass names it, otherwise in `supersededDuringVerify`. Deleted snapshots are
|
||||
listed in `snapshotsDeletedDuringVerify` as not fully covered.
|
||||
@@ -208,9 +214,12 @@ read; a chunk damaged after its check is the next pass's finding.
|
||||
|
||||
A pass that cannot finish is **incomplete**, never clean: `complete` is false and
|
||||
`incomplete` gives the reason: `deadline`, `cancelled`, `error` (a filer or blob
|
||||
store failure, or a refused request) or `closing_rounds_exhausted` (each of the 3
|
||||
final reads named new chunks: the volume is too busy; re-run). Its findings are
|
||||
those computed from the chunks it did check.
|
||||
store failure, a refused request, or a final read that returned an older HEAD),
|
||||
`closing_rounds_exhausted` (each of the 3 final reads named new chunks: the volume
|
||||
is too busy; re-run), `head_absent` (the final read found no HEAD) or
|
||||
`head_invalid` (the final read's HEAD does not decode; also a `ROOT_INVALID`
|
||||
finding). Its findings are those computed from the chunks it did check, for the
|
||||
roots of its last view (none for HEAD in the last two cases).
|
||||
|
||||
### What verify cannot check
|
||||
|
||||
@@ -231,7 +240,8 @@ those computed from the chunks it did check.
|
||||
- `3`: the pass completed with findings. This includes `READ_ERROR`: the pass
|
||||
did not verify everything.
|
||||
- `1`: the pass could not complete (the deadline passed, the filer failed, HEAD
|
||||
kept naming new chunks, the volume or snapshot does not exist, or the filer is
|
||||
kept naming new chunks, HEAD was gone or did not decode at the final read, the
|
||||
volume or snapshot does not exist, or the filer is
|
||||
not the only one of its group). The error body `{code,message,retryable}` is
|
||||
printed with the partial result, and its `incomplete` reason, under `verify`.
|
||||
- `2`: usage error.
|
||||
@@ -35,12 +35,20 @@ package chunkstore
|
||||
// the pass checks it and reads again, at most ClosingRounds times
|
||||
// (V.GiveUp: then the pass is incomplete).
|
||||
// - V.Close: a closing read that names no chunk not seen is the final view.
|
||||
// Only a decodable HEAD, not older than the view, can close a pass as
|
||||
// complete: a closing read that finds no HEAD, or one that does not
|
||||
// decode (ROOT_INVALID), leaves no HEAD root and the pass incomplete.
|
||||
// - V.Reconcile: the findings about chunks and segments are computed from
|
||||
// the outcomes and the final view alone, nowhere else: a bad chunk is
|
||||
// one finding under the first final root naming its key (HEAD, then the
|
||||
// snapshots not gone, in order) at that root's first index; a key HEAD
|
||||
// dropped and names again is ROOT_INVALID, whatever its outcome.
|
||||
//
|
||||
// A segment is an object of the same automaton, keyed by (owner, key): read
|
||||
// once, its outcome kept; a root whose reference matches its content gets its
|
||||
// chunk references, a root whose reference does not has a mismatch; its
|
||||
// problems are reported by the chunk rule.
|
||||
//
|
||||
// The pass therefore reports the state of each named chunk at its check,
|
||||
// for the roots at the final read; a chunk damaged after its check is the
|
||||
// next pass's finding. A chunk that left HEAD can be collected after GC's
|
||||
@@ -154,19 +162,23 @@ const (
|
||||
verifyHookRootsWalked = "roots-walked" // the selected snapshots have been read and walked too
|
||||
verifyHookBatchChecked = "batch-checked" // a batch of checks has settled
|
||||
verifyHookClosingRead = "closing-read" // a closing read is about to be made
|
||||
verifyHookClosed = "closed" // the quiet closing read was made: the final view is fixed
|
||||
)
|
||||
|
||||
// VerifyIncomplete is why a pass did not complete.
|
||||
type VerifyIncomplete string
|
||||
|
||||
const (
|
||||
VerifyIncompleteDeadline VerifyIncomplete = "deadline" // the caller's deadline passed
|
||||
VerifyIncompleteCancelled VerifyIncomplete = "cancelled" // the caller cancelled
|
||||
VerifyIncompleteRounds VerifyIncomplete = "closing_rounds_exhausted" // every closing read named new chunks
|
||||
VerifyIncompleteError VerifyIncomplete = "error" // a filer or blob store failure, or a refused request
|
||||
VerifyIncompleteDeadline VerifyIncomplete = "deadline" // the caller's deadline passed
|
||||
VerifyIncompleteCancelled VerifyIncomplete = "cancelled" // the caller cancelled
|
||||
VerifyIncompleteRounds VerifyIncomplete = "closing_rounds_exhausted" // every closing read named new chunks
|
||||
VerifyIncompleteHeadAbsent VerifyIncomplete = "head_absent" // the closing read found no HEAD
|
||||
VerifyIncompleteHeadInvalid VerifyIncomplete = "head_invalid" // the closing read's HEAD does not decode
|
||||
VerifyIncompleteError VerifyIncomplete = "error" // a filer or blob store failure, or a refused request
|
||||
)
|
||||
|
||||
// CodeVerifyIncomplete: every closing read named chunks not seen before.
|
||||
// CodeVerifyIncomplete: the closing reads could not close the pass (each
|
||||
// named chunks not seen before, or the last found no usable HEAD).
|
||||
const CodeVerifyIncomplete = "verify_incomplete"
|
||||
|
||||
// VerifyFinding is one problem found. Segment is set for a segment's own
|
||||
@@ -272,7 +284,7 @@ func (c *Catalog) Verify(ctx context.Context, vol string, opts VerifyOptions) (V
|
||||
return refuse(err)
|
||||
}
|
||||
v := &verifier{c: c, vol: vol, root: root, opts: opts, res: &res, blobs: c.blobs,
|
||||
segs: map[verifySegKey]*verifiedSegment{}, chunks: map[string]*verifyChunk{}, dropped: map[string]bool{},
|
||||
segs: map[string]*verifySegment{}, chunks: map[string]*verifyChunk{}, dropped: map[string]bool{},
|
||||
pacer: &verifyPacer{rate: opts.BytesPerSecond}}
|
||||
err = v.run(ctx)
|
||||
v.reconcile()
|
||||
@@ -283,6 +295,10 @@ func (c *Catalog) Verify(ctx context.Context, vol string, opts VerifyOptions) (V
|
||||
res.DistinctChunks = len(v.chunks)
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, errVerifyHeadAbsent):
|
||||
res.Incomplete = VerifyIncompleteHeadAbsent
|
||||
case errors.Is(err, errVerifyHeadInvalid):
|
||||
res.Incomplete = VerifyIncompleteHeadInvalid
|
||||
case CodeOf(err) == CodeVerifyIncomplete:
|
||||
res.Incomplete = VerifyIncompleteRounds
|
||||
case errors.Is(err, context.DeadlineExceeded):
|
||||
@@ -298,20 +314,39 @@ func (c *Catalog) Verify(ctx context.Context, vol string, opts VerifyOptions) (V
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// verifySegKey names a segment reference: a segment object is immutable, so
|
||||
// one read under the same reference needs no second read.
|
||||
type verifySegKey struct {
|
||||
group, chunkBytes uint64
|
||||
ref storage.ChunkSegment
|
||||
}
|
||||
// Why a closing read leaves no HEAD root (wrapped in CodeVerifyIncomplete).
|
||||
var (
|
||||
errVerifyHeadAbsent = errors.New("chunkstore: verify: the closing read found no HEAD")
|
||||
errVerifyHeadInvalid = errors.New("chunkstore: verify: the closing read's HEAD does not decode")
|
||||
)
|
||||
|
||||
// verifiedSegment is a segment as read once: its chunks, or the problems
|
||||
// that make it unusable (issue) or doomed (tombstoned binding).
|
||||
type verifiedSegment struct {
|
||||
chunks map[uint64]storage.ChunkRef
|
||||
// verifySegment is one segment object (owner, key): read once, like a chunk
|
||||
// (keys are never rebound), its outcome kept, and per root reference the
|
||||
// result of using it. Its chunk references are decoded under the first
|
||||
// reference that matches its content; the body is kept until then.
|
||||
type verifySegment struct {
|
||||
owner, key string
|
||||
fid string
|
||||
tombstoned bool
|
||||
issue *segIssue
|
||||
issue *segIssue // the object could not be read: its outcome
|
||||
sum [32]byte // the content's SHA-256, once read
|
||||
body []byte
|
||||
decoded *segUse // the use that decoded it (with decodedBy)
|
||||
decodedBy segRef
|
||||
uses map[segRef]segUse
|
||||
}
|
||||
|
||||
// segRef is one root's reference to a segment, with what decoding it depends on.
|
||||
type segRef struct {
|
||||
group, chunkBytes, remoteLSN uint64
|
||||
ref storage.ChunkSegment
|
||||
}
|
||||
|
||||
// segUse is the result of using a segment under one reference: its chunk
|
||||
// references, or the problem for that root (issue).
|
||||
type segUse struct {
|
||||
chunks map[uint64]storage.ChunkRef
|
||||
issue *segIssue
|
||||
}
|
||||
|
||||
// segIssue is why a segment could not be used.
|
||||
@@ -319,6 +354,9 @@ type segIssue struct {
|
||||
class, fid, detail string
|
||||
}
|
||||
|
||||
// segID is a segment's identity: its owner and key.
|
||||
func segID(vol string, ref storage.ChunkSegment) string { return chunkIdentity(vol, ref.Key) }
|
||||
|
||||
// verifyChunk is one distinct chunk (owner volume + the owner's own key):
|
||||
// unseen while absent from the verifier's map, then queued, then settled.
|
||||
type verifyChunk struct {
|
||||
@@ -363,16 +401,15 @@ type verifier struct {
|
||||
|
||||
mu sync.Mutex
|
||||
res *VerifyResult
|
||||
segs map[verifySegKey]*verifiedSegment // segments read, by reference
|
||||
chunks map[string]*verifyChunk // the chunks seen, by identity
|
||||
pending []*verifyChunk // queued, not yet checked
|
||||
listed bool // the owners' keys/ were listed once
|
||||
segs map[string]*verifySegment // the segments read, by identity
|
||||
chunks map[string]*verifyChunk // the chunks seen, by identity
|
||||
pending []*verifyChunk // queued, not yet checked
|
||||
listed bool // the owners' keys/ were listed once
|
||||
|
||||
head *verifyView // the HEAD view; nil without a decodable HEAD
|
||||
head *verifyView // the HEAD view; nil without a usable HEAD
|
||||
dropped map[string]bool // keys a HEAD view named and a later one did not
|
||||
snaps []*verifyView // the selected snapshots, in order
|
||||
lastRefresh time.Time
|
||||
badRefresh bool
|
||||
}
|
||||
|
||||
func (v *verifier) hook(stage string) {
|
||||
@@ -518,6 +555,7 @@ func (v *verifier) run(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
if !named {
|
||||
v.hook(verifyHookClosed)
|
||||
return nil // V.Close: this read is the final view
|
||||
}
|
||||
if rounds++; rounds == v.opts.ClosingRounds {
|
||||
@@ -557,7 +595,7 @@ func (v *verifier) round(ctx context.Context) (bool, error) {
|
||||
named := false
|
||||
if v.head != nil {
|
||||
var err error
|
||||
if named, err = v.readHead(ctx); err != nil {
|
||||
if named, err = v.readHead(ctx, true); err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
@@ -573,24 +611,21 @@ func (v *verifier) round(ctx context.Context) (bool, error) {
|
||||
|
||||
// ---- roots and segments ----
|
||||
|
||||
// segment returns h's segment group as read once by this pass (keys
|
||||
// owner-qualified, verified through the decoder GC and the chunk layer
|
||||
// use), reading it the first time. An error stops the pass.
|
||||
func (v *verifier) segment(ctx context.Context, h storage.ChunkHead, group uint64) (*verifiedSegment, error) {
|
||||
ref := h.Segments[group]
|
||||
k := verifySegKey{group: group, chunkBytes: h.ChunkBytes, ref: ref}
|
||||
if s := v.segs[k]; s != nil {
|
||||
// V.Discover and V.Settle (segments): the segment ref names, read once per (owner, key) by this pass, its outcome kept. An error stops the pass.
|
||||
func (v *verifier) segment(ctx context.Context, ref storage.ChunkSegment) (*verifySegment, error) {
|
||||
id := segID(v.vol, ref)
|
||||
if s := v.segs[id]; s != nil {
|
||||
return s, nil
|
||||
}
|
||||
s, err := v.readSegment(ctx, h, group, ref)
|
||||
s, err := v.readSegment(ctx, ref)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.segs[k] = s
|
||||
v.segs[id] = s
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (v *verifier) readSegment(ctx context.Context, h storage.ChunkHead, group uint64, ref storage.ChunkSegment) (*verifiedSegment, error) {
|
||||
func (v *verifier) readSegment(ctx context.Context, ref storage.ChunkSegment) (*verifySegment, error) {
|
||||
if v.blobs == nil {
|
||||
return nil, errors.New("chunkstore: verify needs a blob reader for segmented roots")
|
||||
}
|
||||
@@ -598,21 +633,26 @@ func (v *verifier) readSegment(ctx context.Context, h storage.ChunkHead, group u
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s := &verifySegment{owner: ref.Owner, key: ref.Key, uses: map[segRef]segUse{}}
|
||||
dir, name, err := r.keyLocation(ref.Key)
|
||||
if err != nil {
|
||||
return &verifiedSegment{issue: &segIssue{FindingSegmentUnreadable, "", err.Error()}}, nil
|
||||
s.issue = &segIssue{FindingSegmentUnreadable, "", err.Error()}
|
||||
return s, nil
|
||||
}
|
||||
e, err := v.c.f.LookupEntry(ctx, dir, name)
|
||||
if errors.Is(err, ErrNotFound) {
|
||||
return &verifiedSegment{issue: &segIssue{FindingSegmentUnreadable, "", "segment binding not found"}}, nil
|
||||
s.issue = &segIssue{FindingSegmentUnreadable, "", "segment binding not found"}
|
||||
return s, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, abortErr(ctx, err, "read segment binding %s/%s", dir, name)
|
||||
}
|
||||
s.fid = string(e.Extended[extFid])
|
||||
if bad := bindingProblem(e); bad != "" {
|
||||
return &verifiedSegment{issue: &segIssue{FindingSegmentUnreadable, string(e.Extended[extFid]), "segment binding: " + bad}}, nil
|
||||
s.issue = &segIssue{FindingSegmentUnreadable, s.fid, "segment binding: " + bad}
|
||||
return s, nil
|
||||
}
|
||||
s := &verifiedSegment{fid: string(e.Extended[extFid]), tombstoned: len(e.Extended[extGCDeleted]) != 0}
|
||||
s.tombstoned = len(e.Extended[extGCDeleted]) != 0
|
||||
v.mu.Lock()
|
||||
v.res.SegmentReads++
|
||||
v.mu.Unlock()
|
||||
@@ -628,24 +668,60 @@ func (v *verifier) readSegment(ctx context.Context, h storage.ChunkHead, group u
|
||||
s.issue = &segIssue{FindingReadError, s.fid, readErrorDetail(err)}
|
||||
return s, nil
|
||||
}
|
||||
r, err = NewChunkRemote(v.c.f, verifyPrefetched{s.fid, body}, v.root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r.mu.Lock()
|
||||
r.fids[ref.Key] = s.fid
|
||||
r.mu.Unlock()
|
||||
one := storage.ChunkHead{Segments: map[uint64]storage.ChunkSegment{group: ref}, ChunkBytes: h.ChunkBytes,
|
||||
ManifestChunkCount: ref.Count, RemoteLSN: h.RemoteLSN, State: storage.ChunkHeadActive}
|
||||
resolved, err := r.resolveManifest(ctx, one)
|
||||
if err != nil {
|
||||
s.issue = &segIssue{FindingSegmentUnreadable, s.fid, err.Error()}
|
||||
if len(body) > maxManifestBytes {
|
||||
s.issue = &segIssue{FindingSegmentUnreadable, s.fid, fmt.Sprintf("segment holds %d bytes, above the %d byte bound", len(body), maxManifestBytes)}
|
||||
return s, nil
|
||||
}
|
||||
s.chunks = resolved.Chunks
|
||||
s.sum, s.body = sha256.Sum256(body), body
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// use returns what root h gets from segment s at group: its chunk references
|
||||
// when h's reference matches the content (decoded through the decoder GC
|
||||
// and the chunk layer use), else the problem for h: a reference whose hash,
|
||||
// or whose other fields, differ from the content's is a CONTENT_MISMATCH;
|
||||
// content that does not decode under a matching reference is unreadable.
|
||||
// Nothing is read: the body is kept until a reference decodes it.
|
||||
func (v *verifier) use(ctx context.Context, s *verifySegment, h storage.ChunkHead, group uint64) segUse {
|
||||
if s.issue != nil {
|
||||
return segUse{issue: s.issue}
|
||||
}
|
||||
k := segRef{group: group, chunkBytes: h.ChunkBytes, remoteLSN: h.RemoteLSN, ref: h.Segments[group]}
|
||||
if u, ok := s.uses[k]; ok {
|
||||
return u
|
||||
}
|
||||
u := segUse{}
|
||||
d := s.decodedBy
|
||||
switch {
|
||||
case k.ref.SHA256 != s.sum:
|
||||
u.issue = &segIssue{FindingContentMismatch, s.fid, fmt.Sprintf("segment SHA-256 %s, reference %s", hex.EncodeToString(s.sum[:]), hex.EncodeToString(k.ref.SHA256[:]))}
|
||||
case s.decoded != nil && d.ref == k.ref && d.group == k.group && d.chunkBytes == k.chunkBytes && (k.ref.SegFormat == 1 || k.ref.MaxBirthLSN <= k.remoteLSN):
|
||||
u.chunks = s.decoded.chunks
|
||||
case s.body == nil:
|
||||
u.issue = &segIssue{FindingContentMismatch, s.fid, "the reference has the segment's SHA-256 but not the rest of the reference it was decoded under"}
|
||||
default:
|
||||
r, err := NewChunkRemote(v.c.f, verifyPrefetched{s.fid, s.body}, v.root)
|
||||
if err != nil {
|
||||
u.issue = &segIssue{FindingSegmentUnreadable, s.fid, err.Error()}
|
||||
break
|
||||
}
|
||||
r.mu.Lock()
|
||||
r.fids[k.ref.Key] = s.fid
|
||||
r.mu.Unlock()
|
||||
one := storage.ChunkHead{Segments: map[uint64]storage.ChunkSegment{group: k.ref}, ChunkBytes: h.ChunkBytes,
|
||||
ManifestChunkCount: k.ref.Count, RemoteLSN: h.RemoteLSN, State: storage.ChunkHeadActive}
|
||||
resolved, err := r.resolveManifest(ctx, one)
|
||||
if err != nil {
|
||||
u.issue = &segIssue{FindingSegmentUnreadable, s.fid, err.Error()}
|
||||
break
|
||||
}
|
||||
u.chunks = resolved.Chunks
|
||||
s.decoded, s.decodedBy, s.body = &u, k, nil
|
||||
}
|
||||
s.uses[k] = u
|
||||
return u
|
||||
}
|
||||
|
||||
// bindingProblem is what makes e unusable as a chunk key binding, or "".
|
||||
func bindingProblem(e *filerpb.Entry) string {
|
||||
switch {
|
||||
@@ -672,24 +748,20 @@ func (v *verifier) walk(ctx context.Context, h storage.ChunkHead) (map[uint64]st
|
||||
}
|
||||
return out, unusable, nil
|
||||
}
|
||||
groups := make([]uint64, 0, len(h.Segments))
|
||||
for g := range h.Segments {
|
||||
groups = append(groups, g)
|
||||
}
|
||||
sort.Slice(groups, func(i, j int) bool { return groups[i] < groups[j] })
|
||||
for _, g := range groups {
|
||||
for _, g := range sortedGroups(h.Segments) {
|
||||
v.mu.Lock()
|
||||
v.res.SegmentsChecked++
|
||||
v.mu.Unlock()
|
||||
s, err := v.segment(ctx, h, g)
|
||||
s, err := v.segment(ctx, h.Segments[g])
|
||||
if err != nil {
|
||||
return out, unusable, err
|
||||
}
|
||||
if s.issue != nil {
|
||||
u := v.use(ctx, s, h, g)
|
||||
if u.issue != nil {
|
||||
unusable[g] = true
|
||||
continue
|
||||
}
|
||||
for idx, cr := range s.chunks {
|
||||
for idx, cr := range u.chunks {
|
||||
out[idx] = cr
|
||||
}
|
||||
}
|
||||
@@ -987,29 +1059,42 @@ func (v *verifier) maybeRefresh(ctx context.Context) error {
|
||||
if v.head == nil || v.c.now().Sub(v.lastRefresh) < v.opts.RefreshInterval {
|
||||
return nil
|
||||
}
|
||||
_, err := v.readHead(ctx)
|
||||
_, err := v.readHead(ctx, false)
|
||||
return err
|
||||
}
|
||||
|
||||
// readHead reads HEAD and applies it (V.Refresh); a HEAD that is gone, or does
|
||||
// not decode (reported once), changes nothing. It reports whether HEAD named
|
||||
// a chunk not seen.
|
||||
func (v *verifier) readHead(ctx context.Context) (bool, error) {
|
||||
// readHead reads HEAD and applies it (V.Refresh); it reports whether HEAD
|
||||
// named a chunk not seen. A periodic read that finds no HEAD, one that does
|
||||
// not decode, or an older generation changes nothing: the closing read
|
||||
// decides. At the closing read (closing set) every answer decides the final
|
||||
// view: no HEAD leaves no HEAD root and the pass incomplete (HEAD absent);
|
||||
// an undecodable one is ROOT_INVALID, no HEAD root, incomplete (HEAD
|
||||
// invalid); an older generation than the view cannot be the final view and
|
||||
// cannot keep the earlier one, so the pass is incomplete (an error).
|
||||
func (v *verifier) readHead(ctx context.Context, closing bool) (bool, error) {
|
||||
v.lastRefresh = v.c.now()
|
||||
e, err := v.c.f.LookupEntry(ctx, v.root, headName)
|
||||
if errors.Is(err, ErrNotFound) {
|
||||
return false, nil
|
||||
if !closing {
|
||||
return false, nil
|
||||
}
|
||||
v.head = nil
|
||||
return false, catErr(CodeVerifyIncomplete, true, errVerifyHeadAbsent, "verify of %s: the closing read found no HEAD; the pass has no HEAD to report against", v.vol)
|
||||
}
|
||||
if err != nil {
|
||||
return false, abortErr(ctx, err, "refresh HEAD of %s", v.vol)
|
||||
}
|
||||
h, err := decodeHead(path.Join(v.root, headName), e)
|
||||
if err != nil {
|
||||
if !v.badRefresh {
|
||||
v.badRefresh = true
|
||||
v.finding(VerifyFinding{Root: "HEAD", Class: FindingRootInvalid, Detail: "refreshed HEAD: " + err.Error()})
|
||||
if !closing {
|
||||
return false, nil
|
||||
}
|
||||
return false, nil
|
||||
v.head = nil
|
||||
v.finding(VerifyFinding{Root: "HEAD", Class: FindingRootInvalid, Detail: "HEAD at the closing read: " + err.Error()})
|
||||
return false, catErr(CodeVerifyIncomplete, true, errVerifyHeadInvalid, "verify of %s: the HEAD of the closing read does not decode", v.vol)
|
||||
}
|
||||
if closing && v.head != nil && h.Gen < v.head.h.Gen {
|
||||
return false, remoteErr(nil, "verify of %s: the closing read returned HEAD gen %d, older than gen %d already read", v.vol, h.Gen, v.head.h.Gen)
|
||||
}
|
||||
return v.refresh(ctx, h)
|
||||
}
|
||||
@@ -1370,33 +1455,99 @@ func (v *verifier) reconcile() {
|
||||
}
|
||||
}
|
||||
}
|
||||
for k, s := range v.segs {
|
||||
var issues []segIssue
|
||||
if s.tombstoned && v.opts.Depth != VerifyMeta {
|
||||
issues = append(issues, segIssue{FindingBindingTombstoned, s.fid, "segment binding tombstoned by GC"})
|
||||
}
|
||||
if s.issue != nil {
|
||||
issues = append(issues, *s.issue)
|
||||
}
|
||||
if len(issues) == 0 {
|
||||
continue
|
||||
}
|
||||
var at *verifyView
|
||||
for _, r := range roots {
|
||||
if r.namesSegment(k) {
|
||||
at = r
|
||||
break
|
||||
segIDs := make([]string, 0, len(v.segs))
|
||||
for id := range v.segs {
|
||||
segIDs = append(segIDs, id)
|
||||
}
|
||||
sort.Strings(segIDs)
|
||||
for _, id := range segIDs {
|
||||
v.reconcileSegment(roots, id, v.segs[id])
|
||||
}
|
||||
}
|
||||
|
||||
// reconcileSegment reports segment id by the chunk rule: its own problems
|
||||
// (unreadable, read error, tombstoned binding) and each final reference's
|
||||
// (mismatch, undecodable) at most once per class, under the first final root
|
||||
// naming it at that root's first group; a problem no final root names is
|
||||
// counted once.
|
||||
func (v *verifier) reconcileSegment(roots []*verifyView, id string, s *verifySegment) {
|
||||
type at struct {
|
||||
root int
|
||||
group uint64
|
||||
}
|
||||
var naming []at
|
||||
for ri, r := range roots {
|
||||
for _, g := range sortedGroups(r.h.Segments) {
|
||||
if segID(v.vol, r.h.Segments[g]) == id {
|
||||
naming = append(naming, at{ri, g})
|
||||
}
|
||||
}
|
||||
if at == nil {
|
||||
v.unnamed(func(s *verifyView) bool { return s.namesSegment(k) })
|
||||
}
|
||||
var own []segIssue
|
||||
if s.tombstoned && v.opts.Depth != VerifyMeta {
|
||||
own = append(own, segIssue{FindingBindingTombstoned, s.fid, "segment binding tombstoned by GC"})
|
||||
}
|
||||
if s.issue != nil {
|
||||
own = append(own, *s.issue)
|
||||
}
|
||||
if len(naming) == 0 {
|
||||
if len(own) != 0 {
|
||||
v.unnamed(func(r *verifyView) bool { return r.namesSegment(v.vol, id) })
|
||||
}
|
||||
return
|
||||
}
|
||||
report := func(a at, is segIssue) {
|
||||
g := a.group
|
||||
v.finding(VerifyFinding{Root: roots[a.root].label, Segment: &g, Owner: s.owner, Key: s.key, FID: is.fid, Class: is.class, Detail: is.detail})
|
||||
}
|
||||
for _, is := range own {
|
||||
report(naming[0], is)
|
||||
}
|
||||
if s.issue != nil {
|
||||
return
|
||||
}
|
||||
type problem struct {
|
||||
at at
|
||||
issue segIssue
|
||||
more int
|
||||
next string
|
||||
}
|
||||
var problems []*problem
|
||||
byClass := map[string]*problem{}
|
||||
for _, a := range naming {
|
||||
u := v.use(context.Background(), s, roots[a.root].h, a.group)
|
||||
if u.issue == nil {
|
||||
continue
|
||||
}
|
||||
for _, is := range issues {
|
||||
g := k.group
|
||||
v.finding(VerifyFinding{Root: at.label, Segment: &g, Owner: k.ref.Owner, Key: k.ref.Key, FID: is.fid, Class: is.class, Detail: is.detail})
|
||||
if p := byClass[u.issue.class]; p != nil {
|
||||
p.more++
|
||||
if p.next == "" && a.root != p.at.root {
|
||||
p.next = roots[a.root].label
|
||||
}
|
||||
continue
|
||||
}
|
||||
p := &problem{at: a, issue: *u.issue}
|
||||
byClass[u.issue.class] = p
|
||||
problems = append(problems, p)
|
||||
}
|
||||
for _, p := range problems {
|
||||
if p.more > 0 {
|
||||
p.issue.detail += fmt.Sprintf("; %d more final reference(s) with this problem", p.more)
|
||||
if p.next != "" {
|
||||
p.issue.detail += ", next under " + p.next
|
||||
}
|
||||
}
|
||||
report(p.at, p.issue)
|
||||
}
|
||||
}
|
||||
|
||||
func sortedGroups(m map[uint64]storage.ChunkSegment) []uint64 {
|
||||
out := make([]uint64, 0, len(m))
|
||||
for g := range m {
|
||||
out = append(out, g)
|
||||
}
|
||||
sort.Slice(out, func(i, j int) bool { return out[i] < out[j] })
|
||||
return out
|
||||
}
|
||||
|
||||
// unnamed counts a bad chunk or segment no final root names: root deleted
|
||||
@@ -1420,9 +1571,13 @@ func (r *verifyView) namesChunk(vol, id string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *verifyView) namesSegment(k verifySegKey) bool {
|
||||
ref, ok := r.h.Segments[k.group]
|
||||
return ok && ref == k.ref && r.h.ChunkBytes == k.chunkBytes
|
||||
func (r *verifyView) namesSegment(vol, id string) bool {
|
||||
for _, ref := range r.h.Segments {
|
||||
if segID(vol, ref) == id {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// verifyPacer spaces reads so they average at most rate bytes per second.
|
||||
|
||||
@@ -566,8 +566,9 @@ func TestVerify_TombstonedBinding(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A corrupt segment and a segment whose binding is gone are each a finding;
|
||||
// the pass goes on to the other segments and their chunks.
|
||||
// A corrupt segment (its content no longer matches the root's reference: a
|
||||
// mismatch for that root) and a segment whose binding is gone are each a
|
||||
// finding; the pass goes on to the other segments and their chunks.
|
||||
func TestVerify_UnreadableSegmentContinues(t *testing.T) {
|
||||
fx := newVerifyFixture(t, "v1")
|
||||
h := fx.publish("v1", map[uint64][]byte{0: verifyData(1), verifyPer: verifyData(2), 2 * verifyPer: verifyData(3)}, false)
|
||||
@@ -575,11 +576,11 @@ func TestVerify_UnreadableSegmentContinues(t *testing.T) {
|
||||
fx.deleteBinding(h.Segments[1].Key)
|
||||
fx.deleteBinding(h.Chunks[2*verifyPer].Key)
|
||||
res := fx.verify("v1", VerifyOptions{})
|
||||
wantClasses(t, "bindings", res, "SEGMENT_UNREADABLE@seg0", "SEGMENT_UNREADABLE@seg1", fmt.Sprintf("BINDING_MISSING@%d", 2*verifyPer))
|
||||
wantClasses(t, "bindings", res, "CONTENT_MISMATCH@seg0", "SEGMENT_UNREADABLE@seg1", fmt.Sprintf("BINDING_MISSING@%d", 2*verifyPer))
|
||||
if res.SegmentsChecked != 3 || res.ChunksChecked != 1 {
|
||||
t.Fatalf("summary %+v", res)
|
||||
}
|
||||
if !strings.Contains(res.Findings[0].Detail, "hash") || res.Findings[0].Key != h.Segments[0].Key {
|
||||
if !strings.Contains(res.Findings[0].Detail, "SHA-256") || res.Findings[0].Key != h.Segments[0].Key {
|
||||
t.Fatalf("corrupt segment finding %+v", res.Findings[0])
|
||||
}
|
||||
}
|
||||
@@ -1722,3 +1723,195 @@ func TestVerify_SnapshotDocumentNamingAnotherSnapshot(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// The closing read decides the final view: a HEAD that is gone, or that
|
||||
// does not decode, leaves no HEAD root and makes the pass incomplete; it
|
||||
// never closes on an earlier view. A bad chunk only that HEAD named is then
|
||||
// counted as superseded, not reported.
|
||||
func TestVerify_ClosingReadWithoutUsableHeadIsIncomplete(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
bad bool // chunk 0's needle is missing
|
||||
undecoded bool // the closing read finds a HEAD that does not decode (else none)
|
||||
want []string
|
||||
reason VerifyIncomplete
|
||||
superseded int
|
||||
}{
|
||||
{"HEAD gone, bad chunk", true, false, nil, VerifyIncompleteHeadAbsent, 1},
|
||||
{"HEAD gone, good chunks", false, false, nil, VerifyIncompleteHeadAbsent, 0},
|
||||
{"HEAD does not decode", true, true, []string{"ROOT_INVALID"}, VerifyIncompleteHeadInvalid, 1},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
fx := newVerifyFixture(t, "v1")
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
h := fx.publish("v1", map[uint64][]byte{0: verifyData(1), 1: verifyData(2)}, false)
|
||||
if tc.bad {
|
||||
fx.needle(fx.fid(h.Chunks[0].Key), dropNeedle)
|
||||
}
|
||||
done := false
|
||||
opts := VerifyOptions{Depth: VerifyData, BytesPerSecond: -1}
|
||||
opts.hook = func(stage string) {
|
||||
if stage != verifyHookClosingRead || done {
|
||||
return
|
||||
}
|
||||
done = true
|
||||
if tc.undecoded {
|
||||
fx.f.bumpExtended(path.Join(catBase, "v1", headName), extGen, "999")
|
||||
} else if err := fx.f.DeleteEntry(ctx, path.Join(catBase, "v1"), headName, nil); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
res, err := fx.c.Verify(ctx, "v1", opts)
|
||||
if CodeOf(err) != CodeVerifyIncomplete || res.Complete || res.Incomplete != tc.reason {
|
||||
t.Fatalf("verify: %v, complete %v, incomplete %q; want incomplete %q", err, res.Complete, res.Incomplete, tc.reason)
|
||||
}
|
||||
wantClasses(t, tc.name, res, tc.want...)
|
||||
for _, f := range res.Findings {
|
||||
if f.Root == headLabel(h.Gen) {
|
||||
t.Fatalf("finding %+v under the HEAD the closing read no longer returned", f)
|
||||
}
|
||||
}
|
||||
if res.SupersededDuringVerify != tc.superseded {
|
||||
t.Fatalf("superseded %d, want %d", res.SupersededDuringVerify, tc.superseded)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// casHead installs a HEAD whose segment references edit changes, without
|
||||
// writing segments (the chunk references stay those of the current HEAD).
|
||||
func (fx *verifyFixture) casHead(vol string, edit func(segs map[uint64]storage.ChunkSegment)) storage.ChunkHead {
|
||||
fx.t.Helper()
|
||||
ctx := context.Background()
|
||||
r, err := NewChunkRemote(fx.f, fx.b, path.Join(catBase, vol))
|
||||
if err != nil {
|
||||
fx.t.Fatal(err)
|
||||
}
|
||||
cur, err := r.GetHead(ctx)
|
||||
if err != nil {
|
||||
fx.t.Fatal(err)
|
||||
}
|
||||
next := cur
|
||||
next.Chunks = nil
|
||||
next.RemoteLSN = cur.RemoteLSN + 1
|
||||
next.Segments = map[uint64]storage.ChunkSegment{}
|
||||
for g, s := range cur.Segments {
|
||||
next.Segments[g] = s
|
||||
}
|
||||
edit(next.Segments)
|
||||
if next.Gen, err = r.CASHead(ctx, storage.ChunkHeadVersion{Gen: cur.Gen, Epoch: cur.Epoch}, next); err != nil {
|
||||
fx.t.Fatal(err)
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
// A segment is one object per (owner, key), read once: HEAD and an active
|
||||
// snapshot naming one segment key with different reference hashes share its
|
||||
// one outcome. A failed read is one READ_ERROR, under HEAD, counted once; a
|
||||
// readable segment is used by the root whose reference matches its content,
|
||||
// and the other root gets one mismatch finding.
|
||||
func TestVerify_SegmentIsOneObjectPerKey(t *testing.T) {
|
||||
for _, readFails := range []bool{true, false} {
|
||||
t.Run(fmt.Sprintf("read fails=%v", readFails), func(t *testing.T) {
|
||||
fx := newVerifyFixture(t, "v1")
|
||||
ctx := context.Background()
|
||||
h := fx.publish("v1", map[uint64][]byte{0: verifyData(1), 1: verifyData(2)}, false)
|
||||
if _, err := fx.c.CreateSnapshot(ctx, "v1", SnapshotRequest{Name: "s1", RequestID: "r1"}, h); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// HEAD names the same segment key with another reference hash.
|
||||
h2 := fx.casHead("v1", func(segs map[uint64]storage.ChunkSegment) {
|
||||
s := segs[0]
|
||||
s.SHA256[0] ^= 0xff
|
||||
segs[0] = s
|
||||
})
|
||||
segFid := fx.fid(h.Segments[0].Key)
|
||||
if readFails {
|
||||
fx.cb.failReads(segFid, -1)
|
||||
}
|
||||
res := fx.verify("v1", VerifyOptions{Depth: VerifyBindings, AllSnapshots: true})
|
||||
wantReads := 1
|
||||
if readFails {
|
||||
wantClasses(t, "segment read fails", res, "READ_ERROR@seg0")
|
||||
wantReads = verifyReadAttempts // one read, with its retries
|
||||
if res.ChunksNotRead != 1 {
|
||||
t.Fatalf("chunksNotRead %d, want 1", res.ChunksNotRead)
|
||||
}
|
||||
} else {
|
||||
wantClasses(t, "segment matches the snapshot only", res, "CONTENT_MISMATCH@seg0")
|
||||
// The snapshot's reference matches: its chunks are walked and checked.
|
||||
if res.ChunksChecked != 2 || res.DistinctChunks != 2 {
|
||||
t.Fatalf("chunks checked %d, distinct %d; want the snapshot's 2", res.ChunksChecked, res.DistinctChunks)
|
||||
}
|
||||
}
|
||||
if f := res.Findings[0]; f.Root != headLabel(h2.Gen) || f.Key != h.Segments[0].Key {
|
||||
t.Fatalf("finding %+v; want under %q for the segment key", f, headLabel(h2.Gen))
|
||||
}
|
||||
if n := fx.cb.reads(segFid); n != wantReads {
|
||||
t.Fatalf("segment read %d times, want %d", n, wantReads)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// headLookups counts the HEAD reads a pass makes.
|
||||
type headLookups struct {
|
||||
Filer
|
||||
root string
|
||||
mu sync.Mutex
|
||||
n int
|
||||
}
|
||||
|
||||
func (f *headLookups) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) {
|
||||
if dir == f.root && name == headName {
|
||||
f.mu.Lock()
|
||||
f.n++
|
||||
f.mu.Unlock()
|
||||
}
|
||||
return f.Filer.LookupEntry(ctx, dir, name)
|
||||
}
|
||||
|
||||
func (f *headLookups) count() int {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
return f.n
|
||||
}
|
||||
|
||||
// The quiet closing read is the final view: no HEAD read follows it, and a
|
||||
// publication that lands right after it is not part of this pass.
|
||||
func TestVerify_QuietClosingReadIsTheFinalView(t *testing.T) {
|
||||
fx := newVerifyFixture(t, "v1")
|
||||
h := fx.publish("v1", map[uint64][]byte{0: verifyData(1), 1: verifyData(2)}, false)
|
||||
filer := &headLookups{Filer: fx.f, root: path.Join(catBase, "v1")}
|
||||
cat, err := NewCatalog(manifestFilerBlobs{filer, fx.cb}, catBase)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
atClose := -1
|
||||
var h2 storage.ChunkHead
|
||||
opts := VerifyOptions{Depth: VerifyData, BytesPerSecond: -1}
|
||||
opts.hook = func(stage string) {
|
||||
if stage == verifyHookClosed {
|
||||
atClose = filer.count()
|
||||
h2 = fx.publish("v1", map[uint64][]byte{2: verifyData(3)}, true)
|
||||
fx.needle(fx.fid(h2.Chunks[2].Key), dropNeedle)
|
||||
}
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
res, err := cat.Verify(ctx, "v1", opts)
|
||||
if err != nil || !res.Complete {
|
||||
t.Fatalf("verify: %v, %+v", err, res)
|
||||
}
|
||||
if atClose < 0 {
|
||||
t.Fatal("the quiet closing read was never reached")
|
||||
}
|
||||
if n := filer.count(); n != atClose {
|
||||
t.Fatalf("%d HEAD reads after the quiet closing read, want none", n-atClose)
|
||||
}
|
||||
wantClasses(t, "publication after the quiet read", res)
|
||||
if res.HeadGens[len(res.HeadGens)-1] != h.Gen || h2.Gen <= h.Gen {
|
||||
t.Fatalf("covered gens %v (published %d after the close); want the quiet read's %d last", res.HeadGens, h2.Gen, h.Gen)
|
||||
}
|
||||
}
|
||||
@@ -577,12 +577,12 @@ Notes:
|
||||
| `INV-VOLDEL-HELD-HEAD-001` | A delete marks HEAD `deleting` only while no holder holds it; an attach that reaches HEAD first wins. | M6 HEAD: detached → deleting | `core/frontend/chunkstore/volume_delete.go` `markHeadDeleting`, `headHeld` | `TestCatalog_DeleteVolumeLosesToAnAttachAtTheMark` (`core/frontend/chunkstore/volume_delete_test.go`) | — | ACTIVE |
|
||||
| `INV-HEAD-DELETE-FROZEN-001` | Once HEAD is `deleting`, `purging` or `deleted`, `CASHead` refuses every claim or cut; only the delete's own transitions move it. | M6 HEAD: deleting \| purging \| deleted | `core/frontend/chunkstore/chunk_remote.go` `CASHead` | `TestCatalog_DeletedHeadCannotBeRevivedByAClaim` (`core/frontend/chunkstore/volume_delete_test.go`) | `ChunkLifecycleFixed` `NoPublishAfterCommit` | ACTIVE |
|
||||
| `INV-VERIFY-READONLY-001` | Verify writes nothing to the filer or the blob store at any depth: no intent, mark, tombstone, binding or needle. | M6 (reader; no transition) | `core/frontend/chunkstore/verify.go` `Catalog.Verify` | `TestVerify_ReadOnlyAtEveryDepth` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-RECHECK-001` | Verify reports a bad chunk only if a root names it at the final read (HEAD, then the selected snapshots still published under the name they were looked up by); a bad chunk no root names then is counted, not reported. | M6 (reader beside GC mark) | `core/frontend/chunkstore/verify.go` `round`, `reconcile` | `TestVerify_SupersededDuringPass`, `TestVerify_SnapshotDeletedDuringPass`, `TestVerify_SharedChunkReportedUnderStillNamingRoot`, `TestVerify_SnapshotDocumentNamingAnotherSnapshot`, `TestVerify_SchedulesGiveTheSameFindings` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-ONE-READ-001` | Verify checks each distinct chunk at most once per pass: a settled chunk is never checked again, however often a root names it again. | M6 (reader) | `core/frontend/chunkstore/verify.go` `discover`, `settle` | `TestVerify_SchedulesGiveTheSameFindings`, `TestVerify_DedupSharedChunkReadOnce`, `TestVerify_HeadRefreshRewalksChangedSegments` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-NAMED-HAVE-OUTCOME-001` | In a complete pass every chunk the final view names has a settled outcome: the final view is a closing read that names no chunk the pass had not seen. | M6 (reader) | `core/frontend/chunkstore/verify.go` `run`, `round` | `TestVerify_PublishDuringClosingReadIsChecked`, `TestVerify_SchedulesGiveTheSameFindings` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-REPORT-ONCE-001` | A complete pass yields at most one finding per chunk key and class, computed only at Reconcile from the chunk outcomes and the final view. | M6 (reader) | `core/frontend/chunkstore/verify.go` `reconcile` | `TestVerify_SchedulesGiveTheSameFindings`, `TestVerify_TwoWrongReferencesAreOneFinding`, `TestVerify_SameKeyWithAnotherHashIsAFinding` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-RECHECK-001` | Verify reports a bad chunk or segment only if a root of the final view names it: the HEAD the closing read returned (none if it found none or could not decode it), then the selected snapshots still published; else it is counted, not reported. | M6 (reader beside GC mark) | `core/frontend/chunkstore/verify.go` `round`, `readHead`, `reconcile` | `TestVerify_SupersededDuringPass`, `TestVerify_SnapshotDeletedDuringPass`, `TestVerify_SharedChunkReportedUnderStillNamingRoot`, `TestVerify_SnapshotDocumentNamingAnotherSnapshot`, `TestVerify_SchedulesGiveTheSameFindings`, `TestVerify_ClosingReadWithoutUsableHeadIsIncomplete` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-ONE-READ-001` | Verify checks each distinct chunk and reads each segment key at most once per pass: a settled object is never checked again, however often or under whatever reference a root names it again. | M6 (reader) | `core/frontend/chunkstore/verify.go` `discover`, `settle`, `segment` | `TestVerify_SchedulesGiveTheSameFindings`, `TestVerify_DedupSharedChunkReadOnce`, `TestVerify_HeadRefreshRewalksChangedSegments`, `TestVerify_SegmentIsOneObjectPerKey` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-NAMED-HAVE-OUTCOME-001` | In a complete pass every chunk the final view names has a settled outcome: the final view is the closing read itself, one that names no chunk the pass had not seen, with no read after it. | M6 (reader) | `core/frontend/chunkstore/verify.go` `run`, `round` | `TestVerify_PublishDuringClosingReadIsChecked`, `TestVerify_QuietClosingReadIsTheFinalView`, `TestVerify_SchedulesGiveTheSameFindings` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-REPORT-ONCE-001` | A complete pass yields at most one finding per chunk or segment key and class, computed only at Reconcile from the outcomes and the final view. | M6 (reader) | `core/frontend/chunkstore/verify.go` `reconcile`, `reconcileSegment` | `TestVerify_SchedulesGiveTheSameFindings`, `TestVerify_TwoWrongReferencesAreOneFinding`, `TestVerify_SameKeyWithAnotherHashIsAFinding`, `TestVerify_SegmentIsOneObjectPerKey` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-NO-FALSE-CLEAN-001` | In a complete pass, a chunk the final view names that was bad when checked, or whose key HEAD dropped earlier in the pass and names again, has a finding. | M6 (reader) | `core/frontend/chunkstore/verify.go` `refresh`, `reconcile` | `TestVerify_SchedulesGiveTheSameFindings`, `TestVerify_PublishDuringClosingReadIsChecked` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-CLOSE-BOUND-001` | A pass closes on a closing read that names no chunk it had not seen, within `ClosingRounds` such reads (default 3); otherwise its result is incomplete, with that reason, never clean. | M6 (reader) | `core/frontend/chunkstore/verify.go` `run`, `Catalog.Verify` | `TestVerify_ClosingRoundsExhaustedIsIncomplete` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-CLOSE-BOUND-001` | A pass completes only on a closing read that returns a decodable HEAD naming no chunk it had not seen, within `ClosingRounds` such reads (default 3); otherwise it is incomplete, with its reason, never clean. | M6 (reader) | `core/frontend/chunkstore/verify.go` `run`, `readHead`, `Catalog.Verify` | `TestVerify_ClosingRoundsExhaustedIsIncomplete`, `TestVerify_ClosingReadWithoutUsableHeadIsIncomplete` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-NOTFOUND-001` | Verify reports `NEEDLE_MISSING` only when the blob store answers that the needle does not exist (for SeaweedFS, every location of a fresh volume lookup answers 404); any other read failure is retried and then reported as `READ_ERROR`, which means not verified. | M6 (reader) | `core/frontend/chunkstore/verify.go` `Catalog.Verify`; `core/frontend/chunkstore/swfs.go` `Get` (`ErrBlobNotFound`) | `TestVerify_PersistentReadErrorIsNotAMissingNeedle`, `TestVerify_TransientReadIsRetried`, `TestSWFS_GetNotFoundIsErrBlobNotFound`, `TestSWFS_GetStaleCachedLocationLooksUpAgain`, `TestVerify_MovedVolumeIsNotAMissingNeedle` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-VERIFY-CANCEL-001` | A failed dispatch of chunk reads (a filer error, or the caller's context ending) cancels the reads in progress before joining them, and Verify returns the originating error. | M6 (reader) | `core/frontend/chunkstore/verify.go` `checkData` | `TestVerify_FailedRefreshCancelsReadInProgress`, `TestVerify_CancelDuringReadJoinsReaders` (`core/frontend/chunkstore/verify_test.go`) | — | ACTIVE |
|
||||
| `INV-RESTORE-INDEPENDENT-001` | `RESTORE-INDEPENDENT` is written once, only for a restore volume with a live HEAD whose resolved image holds no ref owned by another volume; a restore without a live HEAD (absent or aborted) never attaches and is never marked. | M6 snapshot: restore → independent | `core/frontend/chunkstore/restore.go` `MarkIndependent`, `foreignRefsOf`; `core/frontend/chunkstore/catalog.go` `EnsureVolume` | `TestRestore_MarkIndependentOnlyWithoutQualifiedRefs`, `TestRestore_WithoutLiveHeadNeverAttaches`, `TestRestore_SourceGoneIsNormal` (`core/frontend/chunkstore/restore_test.go`) | `RestoreIndependence` `Independent`, `NoForeignList` | ACTIVE |
|
||||
|
||||
Reference in new issue
Block a user