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

[DPE-1782] Configuration support #281

Merged
merged 38 commits into from Oct 26, 2023
Merged

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Oct 5, 2023

Issue

There is no way to provide custom configurations to the workload (PostgreSQL database).

Solution

Add to patroni.yaml the requested configurations with their default values.

Expose the allowed configurations through charm config options (and add validators based on the allowed values).

max_connections and max_prepared_transactions can be changed only through the Patroni API, so they are changed in the charm code differently from the other configurations.

Also, added a call to time.sleep(10) to give some time to Patroni to reload the configurations before it's possible to know which ones need a database restart. Previously, sometimes a change in shared_buffers wouldn't trigger a restart.

@marceloneppel marceloneppel changed the title (WIP) [DPE-1782] configuration support (WIP) [DPE-1782] Configuration support Oct 5, 2023
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

Great refactoring and well readable implementation.
One question inside, otherwise LGTM.

src/charm.py Outdated Show resolved Hide resolved
src/config.py Outdated Show resolved Hide resolved
config.yaml Outdated Show resolved Hide resolved
config.yaml Outdated
type: boolean
logging_log_min_duration_statement:
description: |
Sets the minimum running time above which statements will be logged
Copy link
Member

Choose a reason for hiding this comment

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

we need units for all relevant options.
or maybe even link to https://postgresqlco.nf/doc/en/param/log_min_duration_statement/14/ if Alex approve

Suggested change
Sets the minimum running time above which statements will be logged
Sets the minimum running time above which statements will be logged (ms)

Copy link
Member Author

Choose a reason for hiding this comment

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

Added defaults, allowed values and unit on fac0b95.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed with Marcelo, I would avoid references to the external resources we are not controlling.
Otherwise it will be hard to build consistent UX.

marceloneppel added a commit to canonical/postgresql-operator that referenced this pull request Oct 19, 2023
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

Nice!

marceloneppel added a commit to canonical/postgresql-operator that referenced this pull request Oct 24, 2023
* Add missing parameters and add configuration support

* Use fixed snap

* Fix parameters validation

* Add validations

* Update library

* Revert changes on charm.py

* Add configuration logic and tests

* PR feedback (including the feedback from canonical/postgresql-k8s-operator#281)

* Fix TLS tests

* Increase timeout
@marceloneppel marceloneppel merged commit b0641cc into main Oct 26, 2023
31 of 32 checks passed
@marceloneppel marceloneppel deleted the dpe-1782-configuration-support branch October 26, 2023 02:06
BON4 pushed a commit to BON4/postgresql-operator that referenced this pull request Apr 23, 2024
* Add missing parameters and add configuration support

* Use fixed snap

* Fix parameters validation

* Add validations

* Update library

* Revert changes on charm.py

* Add configuration logic and tests

* PR feedback (including the feedback from canonical/postgresql-k8s-operator#281)

* Fix TLS tests

* Increase timeout
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

4 participants