Cleaner way to disable merge bases during preview (#4711)

Switch to a cleaner way of disabling merge bases when making a preview backup. This sets the flag to not find merge bases instead of finding them and then dropping them.

Manually tested running a backup with `--preview` (local dev flag) and
`--disable-incrementals` and verified in the log that merge bases were
dropped 

---

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

#### Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2023-11-17 14:05:56 -08:00 committed by GitHub
parent f4ed4d7250
commit 8cf2c1b294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -412,23 +412,6 @@ func (op *BackupOperation) do(
}
}
// Drop merge bases if we're doing a preview backup. Preview backups may use
// different delta token parameters so we need to ensure we do a token
// refresh. This could eventually be pushed down the stack if we track token
// versions.
//
// TODO(ashmrtn): Until we use token versions to determine this, refactor
// input params to produceManifestsAndMetadata and do this in that function
// instead of here.
if op.Options.PreviewLimits.Enabled {
logger.Ctx(ctx).Info("disabling merge bases for preview backup")
mans.DisableMergeBases()
canUseMetadata = false
mdColls = nil
}
ctx = clues.Add(
ctx,
"can_use_metadata", canUseMetadata,
@ -515,7 +498,11 @@ func makeFallbackReasons(tenant string, sel selectors.Selector) ([]identity.Reas
// checker to see if conditions are correct for incremental backup behavior such as
// retrieving metadata like delta tokens and previous paths.
func useIncrementalBackup(sel selectors.Selector, opts control.Options) bool {
return !opts.ToggleFeatures.DisableIncrementals
// Drop merge bases if we're doing a preview backup. Preview backups may use
// different delta token parameters so we need to ensure we do a token
// refresh. This could eventually be pushed down the stack if we track token
// versions.
return !opts.ToggleFeatures.DisableIncrementals && !opts.PreviewLimits.Enabled
}
// ---------------------------------------------------------------------------