Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: don't modify the given cfg.Opts #96770

Merged
merged 1 commit into from
Feb 8, 2023

Conversation

RaduBerinde
Copy link
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

@RaduBerinde RaduBerinde requested a review from jbowens February 8, 2023 03:47
@RaduBerinde RaduBerinde requested review from a team as code owners February 8, 2023 03:47
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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
Copy link
Collaborator

@jbowens jbowens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

thanks for tackling this much-needed cleanup!

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: 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.

@RaduBerinde
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 8, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants