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

nixos/postgresql: replace extraConfig option with settings option #95880

Merged
merged 1 commit into from Aug 29, 2020

Conversation

aanderse
Copy link
Member

Motivation for this change

#94231

ping @jappeace

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@jappeace
Copy link
Contributor

Thank you!

The RFC this PR follows: NixOS/rfcs#42
The idea is to only support essential options an upstream program provides, the other options can be set in an easy to use attribute set.

@aanderse
Copy link
Member Author

The idea is to only support essential options an upstream program provides, the other options can be set in an easy to use attribute set.

In this scenario the motivation is to replace extraConfig which can't be properly merged with settings which can be properly merged, not replace any existing options or imply no new options should be added.

@jappeace
Copy link
Contributor

@aanderse I was just summarizing how I understood that RFC, not what this PR does. My apologies for the confusion.

Copy link
Member

@aszlig aszlig left a comment

Choose a reason for hiding this comment

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

As usual: Thanks for revamping the pgsql/mysql modules :-) Commented on a few nitpicks.

nixos/modules/services/databases/postgresql.nix Outdated Show resolved Hide resolved
nixos/modules/services/databases/postgresql.nix Outdated Show resolved Hide resolved
@aanderse
Copy link
Member Author

Feedback addressed.

@aanderse
Copy link
Member Author

@GrahamcOfBorg test postgresql postgresql-wal-receiver

@aanderse
Copy link
Member Author

Merge conflict resolved. Anyone keen on merging?

@aanderse aanderse merged commit bcdcd5d into NixOS:master Aug 29, 2020
@aanderse aanderse deleted the postgresql-settings branch August 29, 2020 13:12
@rvl
Copy link
Contributor

rvl commented Sep 11, 2020

It would be kinder to users to have a smooth upgrade path.
Is it possible to deprecate extraConfig for one release then remove it in the next release?

@aanderse
Copy link
Member Author

It would be kinder to users to have a smooth upgrade path.
Is it possible to deprecate extraConfig for one release then remove it in the next release?

While I hate making changes that instantly force users to adapt without prior notice, in the case of extraConfig it is "worth it", at least in my opinion.

When asked about keeping both a settings and extraConfig option @infinisil had this to say, which I think is quite relevant:

I'd rather not if possible, because then we have problem of not being able to merge values set in extraConfig with all other values, there are essentially two incompatible ways of specifying configuration then.

Further to this I would argue that migrating from extraConfig to settings is very trivial so it shouldn't take more than a minute or two.

Have I sufficiently addressed your concerns? I'm happy to continue the discussion and consider this further if not.

@rvl
Copy link
Contributor

rvl commented Sep 11, 2020

I suspect that users with existing nixos configurations may resent this as a gratuitous change providing no benefit to them, especially if they need to modify multiple services, or if option merging semantics change. Just my 2c.


Related to this PR itself, I have

services.postgresql.extraConfig = ''
  session_preload_libraries = 'auto_explain'
  auto_explain.log_min_duration = '5s'
'';

Should the postgesql settings option support nested attrsets? E.g.

services.postgresql.settings.auto_explain.log_min_duration = "5s";

@aanderse
Copy link
Member Author

I suspect that users with existing nixos configurations may resent this as a gratuitous change providing no benefit to them, especially if they need to modify multiple services, or if option merging semantics change. Just my 2c.

I would highly encourage you to express your opinions on this in the NixOS/rfcs#42 thread. The more feedback an RFC gets (constructive criticism included) the better the end result.

Should the postgesql settings option support nested attrsets? E.g.

I'm not much of a postgresql user. I was unaware that such options existed. Documentation should be updated to reflect this and explain values like that should be quoted, like so:

services.postgresql.settings."auto_explain.log_min_duration" = "5s";

As a postgresql user would you have any motivation to contribute to this module by enhancing the documentation?

@infinisil
Copy link
Member

infinisil commented Sep 12, 2020

I just posted another comment about backwards compatibility in the RFC (saying it's up to the module writer to decide how to handle backwards compatibility). I guess the original comment by me that @aanderse linked is still relevant, but I think I mostly wrote that in relation to new NixOS modules. So if you create a new module, it should definitely not have an extraConfig if it can instead be settings. The RFC was mainly just intended for new modules because I knew backwards compatibility could be a problem.

While I'd love for all existing modules to eventually adapt the settings approach, I think backwards compatibility is still important, and for popular modules like postgresql it might make sense to keep supporting extraConfig for a while before deprecating it, even though settings won't have its full potential during that time. Maybe one release of it being supported with a deprecation warning would be nice.

@aanderse
Copy link
Member Author

@rvl NixOS is a pretty bleeding edge distro. Unfortunately inconvenient changes happen. I really like the welcoming and collaborative nature of the NixOS community so when I ask: "is this migration really that big of a hassle?" I'm just trying to better understand your perspective.

Here is my perspective: I manage upwards of 40 NixOS machines, each of which has a number of changes required to migrate to 20.09. Out of all the changes required to migrate to 20.09 I personally see extraConfig to settings as one of the least impacting and quickest to manage.

So now that we have had this discussion what can you do if you're still not satisfied with the situation? I would be disappointed if you made a PR add extraConfig back, but I wouldn't discourage it. If you see this as a breaking which isn't acceptable then we can quickly talk to the module maintainers and release managers to get your PR into 20.09. I hope you don't feel this way still, but I'll respect your opinion and try to support your efforts the best I can.

@rvl
Copy link
Contributor

rvl commented Sep 13, 2020

I think I have already made my perspective clear, thanks.
Please make sure you put something in the 20.09 release notes about this.

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

Successfully merging this pull request may close these issues.

None yet

6 participants