Skip to content

fix: reconcile WAL PVC resize before disk-full guard - #11466

Open
JamesatStarling wants to merge 1 commit into
cloudnative-pg:mainfrom
JamesatStarling:dev/11341
Open

JamesatStarling wants to merge 1 commit into
cloudnative-pg:mainfrom
JamesatStarling:dev/11341

Conversation

@JamesatStarling

@JamesatStarling JamesatStarling commented Sep 8, 2026 •

Copy link
Copy Markdown

Description

When a PostgreSQL instance stops because its WAL volume is full, the cluster reconciliation loop returns from the disk-full guard before reaching normal PVC reconciliation. As a result, increasing spec.walStorage.size does not update the existing WAL PVC, leaving recovery dependent on a manual PVC patch.

This change reconciles existing PVCs before evaluating the WAL disk-full guard. It intentionally leaves missing-PVC creation in the existing, lifecycle-gated reconciliation path.

Changes

  • Extract existing-PVC reconciliation from the full PVC workflow
  • Reconcile existing PVCs before the WAL disk-full guard
  • Preserve the existing ordering for missing-PVC creation
  • Add a regression test verifying that a WAL PVC resize is applied before the
    disk-full guard requeues reconciliation

Fixes: #11341

@JamesatStarling
JamesatStarling requested a review from a team as a code owner September 8, 2026 13:27
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.28 release-1.29 release-1.30 labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@JamesatStarling JamesatStarling changed the title fix: reconcile WAL PVC resize before disk-full guard (#11341) fix: reconcile WAL PVC resize before disk-full guard Sep 8, 2026
@@ -234,6 +234,9 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
var errUnknownPlugin *repository.ErrUnknownPlugin
if errors.As(err, &errUnknownPlugin) {
regErr := r.RegisterPhase(
return ctrl.Result{
RequeueAfter: 10 * time.Second,
}, r.RegisterPhase(

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.

I think this is now broken and won't build.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks @GellertBabel I've removed the redundant regErr 🤞🏼

@frucht-salat

Copy link
Copy Markdown

We hit this on v1.30.1 with a single-volume cluster so it is not limited to WAL PVCs.

  • EKS, gp3 StorageClass with allowVolumeExpansion: true, storage.resizeInUseVolumes: true, 1 instance.
  • A WAL archive backlog filled PGDATA; the instance exited with code 4 and the cluster went to Not enough disk space.
  • Patching the PVC request by hand recovered it immediately (online EBS expansion, filesystem resize on next mount).

Reading the change, ReconcileExistingPVCs resolves the storage configuration per PVC role, so the PGDATA PVC is resized from spec.storage.size as well -> this PR should fix the single-volume case too.

Two suggestions:

  1. The regression test already raises spec.storage.size to 2Gi but only asserts the WAL PVC; asserting the PGDATA PVC as well would cover the single-volume case.
  2. The title/description mention only walStorage; mentioning spec.storage would make the PR findable for users without a separate WAL volume (see also [Feature]: Increase the size of the managed cluster PVC even when it is full #11512, which looks like the same root cause).

Appreciating the effort :)!

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

Labels

backport-requested ◀️ This pull request should be backported to all supported releases release-1.28 release-1.30

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Fix WAL-full condition blocking automatic walStorage PVC resize

5 participants