storage: don't modify the given cfg.Opts#96770
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Feb 8, 2023
Merged
Conversation
Member
This change improves the `NewPebble` code to not modify the given `cfg.Opts`. Such behavior is surprising and can trip up tests that reuse the same config. Also, `ResolveEncryptedEnvOptions` and `wrapFilesystemMiddleware` no longer modify the Options directly; and `CheckNoRegistryFile` is now a standalone function. Release note: None Epic: none
8a601fd to
f314232
Compare
jbowens
approved these changes
Feb 8, 2023
Contributor
jbowens
left a comment
There was a problem hiding this comment.
thanks for tackling this much-needed cleanup!
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde)
pkg/storage/pebble.go line 862 at r1 (raw file):
func NewPebble(ctx context.Context, cfg PebbleConfig) (p *Pebble, err error) { // pebble.Open also calls EnsureDefaults, but only after doing a clone. Call // EnsureDefaults beforehand so we have a matching cfg here for when we save
lol at how far this comment had drifted from the cfg.Opts.EnsureDefaults() call that it describes.
Member
Author
|
TFTR! bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change improves the
NewPebblecode to not modify the givencfg.Opts. Such behavior is surprising and can trip up tests that reuse the same config.Also,
ResolveEncryptedEnvOptionsandwrapFilesystemMiddlewareno longer modify theOptionsdirectly; andCheckNoRegistryFileis now a standalone function.Release note: None
Epic: none