Bulk up kopia wrapper error checking in BackupOp (#2281)
## Description Expand error checking for kopia wrapper backup. Kopia may report a number of errors for a snapshot operation but may not give error structs for them. Handle this by checking if there were > 0 errors reported and making our own error struct for this if there are. This will keep the system from reporting a successful backup when kopia had problems reading or uploading data. Errored files in kopia do not become part of the snapshot ## Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No ## Type of change - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup ## Issue(s) * closes #2280 ## Test Plan - [ ] 💪 Manual - [ x ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
3cd82de23a
commit
06efad7028
@ -447,6 +447,22 @@ func (suite *KopiaIntegrationSuite) TestBackupCollections_ReaderError() {
|
||||
assert.False(t, stats.Incomplete)
|
||||
// 5 file and 6 folder entries.
|
||||
assert.Len(t, deets.Details().Entries, 5+6)
|
||||
|
||||
failedPath, err := suite.testPath2.Append(testFileName4, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
ic := i64counter{}
|
||||
|
||||
_, err = suite.w.RestoreMultipleItems(
|
||||
suite.ctx,
|
||||
string(stats.SnapshotID),
|
||||
[]path.Path{failedPath},
|
||||
&ic,
|
||||
)
|
||||
// Files that had an error shouldn't make a dir entry in kopia. If they do we
|
||||
// may run into kopia-assisted incrementals issues because only mod time and
|
||||
// not file size is checked for StreamingFiles.
|
||||
assert.ErrorIs(t, err, ErrNotFound, "errored file is restorable")
|
||||
}
|
||||
|
||||
type backedupFile struct {
|
||||
|
||||
@ -400,7 +400,32 @@ func consumeBackupDataCollections(
|
||||
)
|
||||
}
|
||||
|
||||
return bu.BackupCollections(ctx, bases, cs, tags, isIncremental)
|
||||
kopiaStats, deets, itemsSourcedFromBase, err := bu.BackupCollections(
|
||||
ctx,
|
||||
bases,
|
||||
cs,
|
||||
tags,
|
||||
isIncremental,
|
||||
)
|
||||
|
||||
if kopiaStats.ErrorCount > 0 || kopiaStats.IgnoredErrorCount > 0 {
|
||||
if err != nil {
|
||||
err = errors.Wrapf(
|
||||
err,
|
||||
"kopia snapshot failed with %v catastrophic errors and %v ignored errors",
|
||||
kopiaStats.ErrorCount,
|
||||
kopiaStats.IgnoredErrorCount,
|
||||
)
|
||||
} else {
|
||||
err = errors.Errorf(
|
||||
"kopia snapshot failed with %v catastrophic errors and %v ignored errors",
|
||||
kopiaStats.ErrorCount,
|
||||
kopiaStats.IgnoredErrorCount,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return kopiaStats, deets, itemsSourcedFromBase, err
|
||||
}
|
||||
|
||||
func matchesReason(reasons []kopia.Reason, p path.Path) bool {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user