Skip to content

K8SPG-779 | allow overriding wal_level#1439

Merged
mayankshah1607 merged 15 commits into
mainfrom
K8SPG-779
Feb 18, 2026
Merged

K8SPG-779 | allow overriding wal_level#1439
mayankshah1607 merged 15 commits into
mainfrom
K8SPG-779

Conversation

@mayankshah1607
Copy link
Copy Markdown
Member

CHANGE DESCRIPTION

Problem:
wal_level parameter is not configurable

Solution
Make wal_level configurable via dynamicConfiguration

For Doc/QA, note the following restriction from pg docs:

minimal WAL does not contain sufficient information for point-in-time recovery, so replica or higher must be used to enable continuous archiving (archive_mode) and streaming binary replication

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_level from 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.

mayankshah1607 and others added 2 commits February 12, 2026 18:10
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
@mayankshah1607 mayankshah1607 marked this pull request as draft February 12, 2026 13:19
Copilot AI review requested due to automatic review settings February 12, 2026 13:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread e2e-tests/tests/dynamic-configuration/02-apply-configuration.yaml Outdated
Comment thread e2e-tests/tests/dynamic-configuration/02-apply-configuration.yaml Outdated
@egegunes egegunes added this to the v2.9.0 milestone Feb 12, 2026
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings February 13, 2026 05:42
@mayankshah1607 mayankshah1607 marked this pull request as ready for review February 13, 2026 05:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread docs/content/references/dynamic-configuration.md Outdated
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Comment thread e2e-tests/tests/dynamic-configuration/02-apply-configuration.yaml Outdated
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings February 13, 2026 09:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

egegunes
egegunes previously approved these changes Feb 16, 2026
Copy link
Copy Markdown
Contributor

@egegunes egegunes left a comment

Choose a reason for hiding this comment

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

please fix conflicts

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment on lines +3 to +12
timeout: 30
commands:
- script: |-
set -o errexit
set -o xtrace

source ../../functions

sleep 30 # wait for the operator to apply it via pod exec

Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

  1. Problem: This KUTTL step sets timeout: 30 but the script itself starts with sleep 30, leaving no time for the remaining commands.
  2. Why it matters: The step will frequently exceed its timeout and flake/fail CI even when the feature works.
  3. Fix: Increase the step timeout (or replace the fixed sleep with a bounded retry loop that waits until SHOW wal_level/SHOW restore_command match the expected values).

Copilot uses AI. Check for mistakes.
Comment on lines +32 to +39
// 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")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure that I fully understand how moving this here allows the overriding, can we elaborate?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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

Copilot AI review requested due to automatic review settings February 16, 2026 14:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@hors hors requested a review from gkech February 17, 2026 21:49
@JNKPercona
Copy link
Copy Markdown
Collaborator

Test Name Result Time
backup-enable-disable passed 00:06:05
builtin-extensions passed 00:05:33
custom-envs passed 00:18:46
custom-extensions passed 00:14:31
custom-tls passed 00:06:00
database-init-sql passed 00:02:23
demand-backup passed 00:25:07
demand-backup-offline-snapshot passed 00:13:52
dynamic-configuration passed 00:03:08
finalizers passed 00:03:46
init-deploy passed 00:02:59
huge-pages passed 00:02:47
monitoring passed 00:10:45
monitoring-pmm3 passed 00:08:12
one-pod passed 00:05:47
operator-self-healing passed 00:08:05
pitr passed 00:11:33
scaling passed 00:04:42
scheduled-backup passed 00:26:34
self-healing passed 00:09:11
sidecars passed 00:02:48
standby-pgbackrest passed 00:11:45
standby-streaming passed 00:09:23
start-from-backup passed 00:10:55
tablespaces passed 00:06:50
telemetry-transfer passed 00:03:37
upgrade-consistency passed 00:05:14
upgrade-minor passed 00:06:10
users passed 00:04:50
Summary Value
Tests Run 29/29
Job Duration 01:21:34
Total Test Time 04:11:31

commit: 56df739
image: perconalab/percona-postgresql-operator:PR-1439-56df739a6

@mayankshah1607 mayankshah1607 merged commit d4bfbdb into main Feb 18, 2026
16 checks passed
@mayankshah1607 mayankshah1607 deleted the K8SPG-779 branch February 18, 2026 12:36
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.

6 participants