fix!: remove skipping of unchanged subtrees
Intermediate rounds skipped a directory when its inode version and its ceph.dir.rctime matched the previous round. In the 10,000-file lab test a round snapshot taken seconds after changes skipped tree/ with about 250 changed files in its subdirectories: the inode version of tree/ changes only with its own entries, and Ceph had not yet propagated the rctime of the grandchildren. The target snapshot of that round was incomplete, and its verification skipped the same subtrees; only finalize closed the gap. Every round now scans all metadata again. Base index entries that the old version marked carried are never trusted, so such files are copied in full in the next round. The smallfiles verification now checks only snapshots that sync did not remove. BREAKING CHANGE: the configuration field "full_scan" and the transfer statistic "skipped_subtrees" are removed; a configuration with "full_scan" is rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82c64f9908
commit
6dcb7b676f
16 files changed
+117
-448
No files matched your search
@@ -54,6 +54,14 @@ func allZero(b []byte) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// baseTrusted reports whether the base entry previous still describes the
|
||||
// source node n and its target copy, so the copy may be skipped or patched.
|
||||
// A carried entry was written by an earlier version that skipped subtrees;
|
||||
// it may describe an older round and is never trusted.
|
||||
func baseTrusted(previous baseEntry, n, target storage.Node) bool {
|
||||
return !previous.Carried && previous.Inode == n.Inode && previous.TargetInode == target.Inode && previous.Size == target.Size
|
||||
}
|
||||
|
||||
func (b *nativeTransport) copyRegular(ctx context.Context, job nativeJob) error {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return err
|
||||
@@ -80,7 +88,7 @@ func (b *nativeTransport) copyRegular(ctx context.Context, job nativeJob) error
|
||||
return err
|
||||
}
|
||||
|
||||
trusted = ok && previous.Inode == job.node.Inode && previous.TargetInode == target.Inode && previous.Size == target.Size
|
||||
trusted = ok && baseTrusted(previous, job.node, target)
|
||||
}
|
||||
|
||||
changed := true
|
||||
@@ -95,9 +103,7 @@ func (b *nativeTransport) copyRegular(ctx context.Context, job nativeJob) error
|
||||
|
||||
if changed {
|
||||
usedBlockDiff := false
|
||||
// A carried entry describes an older round than the base snapshot, so
|
||||
// a block delta against the base could miss changes.
|
||||
if trusted && !previous.Carried && job.node.Size >= nativeBlockThreshold {
|
||||
if trusted && job.node.Size >= nativeBlockThreshold {
|
||||
old, err := b.source.Stat(path.Join(b.round.BaseSourcePath, job.rel))
|
||||
if err == nil && old.Kind() == storage.Regular && old.Inode == job.node.Inode {
|
||||
stream, err := b.source.BlockDiff(b.snapRoot, path.Join(b.snapRel, job.rel), b.round.BaseName, b.round.Name)
|
||||
@@ -361,8 +367,8 @@ func (b *nativeTransport) Verify(ctx context.Context, from, to string) error {
|
||||
defer scratch.cleanup()
|
||||
v := &nativeVerification{b: b, to: to, skipData: skipData, index: scratch.index}
|
||||
|
||||
// The walk and the directories stay serial, so subtree skips apply in walk
|
||||
// order. Every other entry is checked by one of the workers.
|
||||
// The walk and the directories stay serial; every other entry is checked by
|
||||
// one of the workers.
|
||||
ctx, cancel := context.WithCancelCause(ctx)
|
||||
defer cancel(nil)
|
||||
workers := b.config.Workers
|
||||
@@ -408,11 +414,7 @@ func (b *nativeTransport) Verify(ctx context.Context, from, to string) error {
|
||||
}
|
||||
|
||||
if n.Kind() == storage.Directory {
|
||||
if err = v.entry(ctx, p, rel, n); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return b.skipped(rel)
|
||||
return v.entry(ctx, p, rel, n)
|
||||
}
|
||||
|
||||
select {
|
||||
@@ -576,7 +578,7 @@ func (b *nativeTransport) verifyInventory(ctx context.Context, to string) error
|
||||
return fmt.Errorf("unexpected native target entry %s", rel)
|
||||
}
|
||||
|
||||
return b.skipped(rel)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user