fix(native): replace the writing client before verification

The writing client kept the caps of the files it wrote last. Every
lookup of the verification client on one of them made the MDS recall
the caps entry by entry, which cost about five seconds per lookup in
the lab and stalled a 100,000-file verification near its end.

Verify now opens a fresh target client, closes the writer, which
returns all caps at once, and keeps writing through the fresh client.
The claim lock is held through a client of its own, so it survives the
change.

Verify also checks non-directory entries in parallel with the
configured number of workers. The walk and the directories stay
serial, so skipped subtrees are handled in walk order.

Transfer statistics report the duration of each round in seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-12-03 21:50:35 +01:00
1 parent c655318c47
commit e2c4549ade
7 files changed
+528 -109

No files matched your search

+7 -6
View File
@@ -27,11 +27,11 @@ type nativeTransport struct {
source, target storage.FS
config Config
// openVerifier opens a separate client of the target for Verify. The
// writing client may cache a ctime that differs from the MDS, so only a
// client without caps of its own sees what other clients see. Nil means
// verify through target.
openVerifier func() (storage.FS, error)
// openTarget opens another client of the target. Claim holds its lock
// through one, so that Verify can replace the writing client: Verify
// closes the writer, which returns all its caps, and continues with a
// fresh client. Nil means Verify and Claim use target as it is.
openTarget func() (storage.FS, error)
log io.Writer
identity string
@@ -629,7 +629,8 @@ func (b *nativeTransport) Statistics() TransferStats {
return TransferStats{Mode: mode, BaseSnapshot: base, FilesVisited: b.visited.Load(),
FilesCopied: b.copied.Load(), BytesCopied: b.written.Load(), BytesVerified: b.checked.Load(),
BlockDiffFiles: b.blockFiles.Load(), SnapDiffEntries: b.diffEntries.Load(),
SkippedSubtrees: b.skippedSubtrees.Load()}
SkippedSubtrees: b.skippedSubtrees.Load(),
Seconds: math.Round(time.Since(b.started).Seconds()*1000) / 1000}
}
// subtreeUnchanged reports whether the source directory rel, with node n,