Skip base finding steps if we don't need bases (#5066)
Minor optimization where we skip trying to find BackupBases if we know
we're going to end up dropping them anyway. This can save us from
loading all the kopia manifests only to discard the information we
pulled from them. Note that this optimization only kicks in for
backups that request no merge bases and no assist bases
("full backup")
Existing test coverage in `operations/manifests_test.go` ensures this
doesn't break base selection altogether
As this is an optimization we don't need to merge this PR if it seems
like it will make code maintenance more difficult going forward
---
#### 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
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup
* #<issue>
#### Test Plan
- [ ] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
This commit is contained in:
parent
db5b73e74d
commit
963d0e3fef
@ -75,6 +75,10 @@ type BackupBases interface {
|
||||
SnapshotAssistBases() []BackupBase
|
||||
}
|
||||
|
||||
func EmptyBackupBase() BackupBases {
|
||||
return &backupBases{}
|
||||
}
|
||||
|
||||
type backupBases struct {
|
||||
mergeBases []BackupBase
|
||||
assistBases []BackupBase
|
||||
|
||||
@ -24,6 +24,17 @@ func produceManifestsAndMetadata(
|
||||
tenantID string,
|
||||
getMetadata, dropAssistBases bool,
|
||||
) (kopia.BackupBases, []data.RestoreCollection, bool, error) {
|
||||
// Just return early if we're going to end up dropping all the bases anyway.
|
||||
// This will avoid loading kopia manifest data in the case that we're doing a
|
||||
// full enumeration and refetching all item data for the resource.
|
||||
//
|
||||
// It's easier to work through later logic if we know that the returned
|
||||
// kopia.BackupBases is non-nil for non-error cases so return a trivial
|
||||
// implementation here.
|
||||
if !getMetadata && dropAssistBases {
|
||||
return kopia.EmptyBackupBase(), nil, false, nil
|
||||
}
|
||||
|
||||
bb, meta, useMergeBases, err := getManifestsAndMetadata(
|
||||
ctx,
|
||||
bf,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user