test(store): damaged pieces are repaired, a drill never passes on an older backup, books ahead and diverged, a disk with no links, headers, sync stand-ins, a destination of 3000 backups
Each test fails without the change it covers: the reviewer's sequence (a byte flipped in backup 2's segment, more backups, a drill, a restore), a damaged stored file found by the rotating share, a drill that must fail when only an older manifest is whole, ahead told from diverged with a new set beside the old, the no-link path (and two writers racing on it), sealed pieces in folders, header settings capped and authenticated, one key derivation per setting, files not downloaded yet, vault scratch files, and a destination of 3000 backups made cheaply (12 MB of manifests, 0.8 KB for the newest, 32 ms to find and read it). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
6a8dc6c88b
commit
9ac47a3f10
8 files changed
+1578
-51
No files matched your search
@@ -382,6 +382,7 @@ impl SetIo for DirSet {
|
||||
}
|
||||
|
||||
fn len(&self, rel: &str) -> std::io::Result<Option<u64>> {
|
||||
self.ctx.traced("len", rel);
|
||||
match std::fs::symlink_metadata(self.path(rel)) {
|
||||
// A link is not a file of a backup: it could lead anywhere.
|
||||
Ok(m) if m.is_file() && online_only(&m) => Err(carry(BackupError::NotDownloaded)),
|
||||
@@ -403,6 +404,7 @@ impl SetIo for DirSet {
|
||||
rel: &str,
|
||||
f: &mut dyn FnMut(&mut dyn Read) -> std::io::Result<()>,
|
||||
) -> std::io::Result<()> {
|
||||
self.ctx.traced("read", rel);
|
||||
let path = self.path(rel);
|
||||
let meta = match std::fs::symlink_metadata(&path) {
|
||||
Ok(m) => m,
|
||||
@@ -443,7 +445,11 @@ impl SetIo for DirSet {
|
||||
fill(&mut w)?;
|
||||
w.flush()?;
|
||||
}
|
||||
file.sync_all()
|
||||
if self.ctx.syncs() {
|
||||
file.sync_all()
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
})();
|
||||
if let Err(e) = written {
|
||||
// Something of ours that failed on its own: its scratch file
|
||||
@@ -474,7 +480,9 @@ impl SetIo for DirSet {
|
||||
return Err(e);
|
||||
}
|
||||
};
|
||||
sync_dir(&parent);
|
||||
if self.ctx.syncs() {
|
||||
sync_dir(&parent);
|
||||
}
|
||||
self.ctx.point("published", rel).map_err(carry)?;
|
||||
Ok(put)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user