K8SPG-779 | allow overriding wal_level#1439
Conversation
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
There was a problem hiding this comment.
Pull request overview
This PR makes the PostgreSQL wal_level parameter configurable by moving it from Mandatory to Default parameters, allowing users to override it via spec.patroni.dynamicConfiguration.postgresql.parameters.
Changes:
- Moved
wal_levelfrom Mandatory to Default parameter set to enable user configuration - Updated unit test expectations to reflect the parameter category change
- Added comprehensive E2E test suite to verify dynamic configuration functionality
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/postgres/parameters.go | Moved wal_level from Mandatory to Default parameters with updated comment explaining it can be overridden |
| internal/postgres/parameters_test.go | Updated test expectations to verify wal_level is now in Default parameter set |
| e2e-tests/tests/dynamic-configuration/00-deploy-operator.yaml | E2E test setup: deploys operator |
| e2e-tests/tests/dynamic-configuration/00-assert.yaml | E2E test validation: verifies operator deployment |
| e2e-tests/tests/dynamic-configuration/01-create-cluster.yaml | E2E test: creates PostgreSQL cluster |
| e2e-tests/tests/dynamic-configuration/01-assert.yaml | E2E test validation: verifies cluster is ready with default configuration |
| e2e-tests/tests/dynamic-configuration/02-apply-configuration.yaml | E2E test: applies dynamic configuration to override wal_level to "replica" |
| e2e-tests/tests/dynamic-configuration/03-verify.yaml | E2E test: queries PostgreSQL to retrieve actual wal_level value |
| e2e-tests/tests/dynamic-configuration/03-assert.yaml | E2E test validation: confirms wal_level was changed to "replica" |
| e2e-tests/tests/dynamic-configuration/99-remove-cluster-gracefully.yaml | E2E test cleanup: removes cluster and operator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
| timeout: 30 | ||
| commands: | ||
| - script: |- | ||
| set -o errexit | ||
| set -o xtrace | ||
|
|
||
| source ../../functions | ||
|
|
||
| sleep 30 # wait for the operator to apply it via pod exec | ||
|
|
There was a problem hiding this comment.
- Problem: This KUTTL step sets
timeout: 30but the script itself starts withsleep 30, leaving no time for the remaining commands. - Why it matters: The step will frequently exceed its timeout and flake/fail CI even when the feature works.
- Fix: Increase the step timeout (or replace the fixed sleep with a bounded retry loop that waits until
SHOW wal_level/SHOW restore_commandmatch the expected values).
| // Enable logical replication in addition to streaming and WAL archiving. | ||
| // Can be overridden via spec.patroni.dynamicConfiguration.postgresql.parameters. | ||
| // PostgreSQL must be restarted when changing this value. | ||
| // - https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-WAL-LEVEL | ||
| // - https://www.postgresql.org/docs/current/runtime-config-replication.html | ||
| // - https://www.postgresql.org/docs/current/logical-replication.html | ||
| parameters.Default.Add("wal_level", "logical") | ||
|
|
There was a problem hiding this comment.
Not sure that I fully understand how moving this here allows the overriding, can we elaborate?
There was a problem hiding this comment.
Its just the way DynamicConfiguration function builds the parameters. Whatever is in Mandatory takes precedence over everything (see this line)
Moving it to Default allows us to configure a parameter with some "default" that can be overridden by dynamicConfiguration
commit: 56df739 |
CHANGE DESCRIPTION
Problem:
wal_levelparameter is not configurableSolution
Make
wal_levelconfigurable via dynamicConfigurationFor Doc/QA, note the following restriction from pg docs:
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
Config/Logging/Testability