Don't try to fetch backup version if no compete backups available (#3230)

Regression from 62daf10213 (diff-f088d3a5f56348ddaf6fbf485c2aeaa6d8b40a860de014f7084db6daf0753829R267)


---

#### 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

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2023-04-27 00:45:56 +05:30 committed by GitHub
parent 6395dcbe39
commit 534924f696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -243,6 +243,7 @@ func (op *BackupOperation) do(
var (
reasons = selectorToReasons(op.Selectors, false)
fallbackReasons = makeFallbackReasons(op.Selectors)
lastBackupVersion = version.NoBackup
)
logger.Ctx(ctx).With(
@ -264,10 +265,12 @@ func (op *BackupOperation) do(
return nil, clues.Wrap(err, "producing manifests and metadata")
}
_, lastBackupVersion, err := lastCompleteBackups(ctx, op.store, mans)
if canUseMetaData {
_, lastBackupVersion, err = lastCompleteBackups(ctx, op.store, mans)
if err != nil {
return nil, clues.Wrap(err, "retrieving prior backups")
}
}
cs, excludes, err := produceBackupDataCollections(
ctx,