Repository navigation
Open
Copy link
Description
Is there an existing issue already for this bug?
- I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
- I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
- I have read the troubleshooting guide and I think this is a new bug.
Contact Details
No response
Version
1.30.0
What version of Kubernetes are you using?
1.35
What is your Kubernetes environment?
Cloud: Amazon EKS
How did you install the operator?
YAML manifest
What happened?
When a cluster hits WAL disk exhaustion, increasing spec.walStorage.size on the cluster resource does not automatically resize the WAL PVC.
Observed Behavior:
- Cluster entered/stayed in a
Not enough disk spacestate. - Controller kept reporting WAL space exhaustion.
- WAL PVC size did not change from the old value after updating cluster spec.
- Manual patching of the WAL PVC request size was required to recover.
- After manual WAL PVC patch, reconciliation resumed and other pending size changes for example a data PVC was then applied automatically.
Impact:
- Recovery from WAL-full required manual intervention.
- This blocked the expected declarative workflow,
spec.walStorage.sizechange should be enough.
Likely Cause:
- Reconciliation was short-circuited by the WAL disk full guard before PVC resize reconciliation could run, creating an ordering deadlock in this failure mode.
Expected Behaviour:
When WAL storage is full and the user increases spec.walStorage.size the order of execution is:
- PVC resize reconciliation runs first.
- WAL PVC size request is patched automatically from cluster spec.
- Disk full guard may still re-queue while the storage backend completes expansion, but resize is already in progress.
- Once expansion is applied by Kubernetes/storage class, the instance recovers without manual PVC patching.
Cluster resource
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Reacted by dosubot, Afeedh Shaji, Dmitry Mishin, Nicholas Zeolla, Achilleas Karatzas and Till Pohland
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsNo status
Activity
dosubot commentedon Aug 19, 2026
@JamesatStarling, your analysis is correct — the code confirms the ordering deadlock you described. Here's the breakdown:
ensureNoFailoverOnFullDiskruns in thereconcilefunction and, when it detects any pod with insufficient WAL space (viaisWALSpaceAvailableOnPod), it registers the phase"Not enough disk space"and immediately returnsRequeueAfter: 10 * time.Second[1].persistentvolumeclaim.Reconcile— the function that would actually resize the WAL PVC to matchspec.walStorage.size— runs insidereconcileResources, which is called much later at line 594.Because the disk-full guard returns early in step 1,
reconcileResourcesis never reached. The PVC resize is skipped on every cycle, and the cluster stays stuck in"Not enough disk space".The fix would involve moving the PVC resize step (or at least the quantity-resize portion) to execute before the
ensureNoFailoverOnFullDiskguard, so the WAL PVC request gets patched in Kubernetes and the CSI resizer can act even while the instance is in the disk-full state.Workaround: You only need to manually patch the stuck instance's WAL PVC. Once that pod comes back to Ready, the operator resumes normal reconciliation and handles any remaining PVC resizes on its own [2]:
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
JamesatStarling commentedon Sep 8, 2026
For reference I've opened a pull request with a suggested fix here: fix: reconcile WAL PVC resize before disk-full guard
fix: reconcile WAL PVC resize before disk-full guard (cloudnative-pg#…
GellertBabel commentedon Oct 1, 2026
After looking at the PR quickly then and now looked more carefully I realized this is not a bug but a feature request. I think this can be an improvement but needs to proceed carefully as this shouldn't boil down to just always reconcile the pvc change first.
My suggestion is to convert the ticket into a feature and align with the maintainers on the direction.
[-][Bug]: Fix WAL-full condition blocking automatic walStorage PVC resize[/-][+][Feat]: Fix WAL-full condition blocking automatic walStorage PVC resize[/+]JamesatStarling commentedon Oct 9, 2026
After further reviewing and discussions with @GellertBabel it appears this isn't actually a bug, but rather a desired enhancement/feature. Could a maintainer please swap the bug label for a feature/enhancement label?
JamesatStarling commentedon Oct 22, 2026
Thanks for the review, my first attempt moved
ReconcileExistingPVCsahead ofensureNoFailoverOnFullDiskunconditionally. I agree that is too broad, and I'd like to agree on a narrower design before reworking the PR.Problem:
When WAL space is exhausted,
ensureNoFailoverOnFullDiskregisters the "Not enough disk space" phase and requeues. It returns before PVC reconciliation runs. A user who increaseswalStorage.sizeto recover therefore has no change applied while the cluster is stuck.Why the first attempt was too broad:
ReconcileExistingPVCsruns every reconciliation unit, soreconcileVolumeAttributeClasswas also moved ahead of the guard. That is unrelated to disk-full recovery.ReconcileExistingPVCstwice per reconcile, because reconcile still calls it later.What the detection can and can't tell us:
isWALSpaceAvailableOnPodonly checks whether the postgres container terminated withMissingWALDiskSpaceExitCode.CheckHasDiskSpaceForWAL, which probesPGDATA/pg_walfor room for one WAL segment.pg_walis full". That is the WAL PVC whenwalStorageis set, and the data PVC otherwise.Proposed design:
isWALSpaceAvailableOnPodreports a pod without WAL space. Otherwise the ordering is unchanged.ReconcilePVCQuantities) instead of the fullReconcileExistingPVCs. Volume attributes class changes and any future units stay after the guard.pg_wal. Patch the WAL PVCs whenwalStorageis configured, and the data PVCs otherwise.ensureNoFailoverOnFullDisk, rather than returning early. The guard returns beforereplicaclusterswitch,handleSwitchoverandreconcileResources, which is where a new target primary gets chosen. Skipping it would allow a failover while the disk is full. The resize is reported through an event and the phase message.ShouldResizeInUseVolumes(), the "cannot decrease" check, andallowVolumeExpansionon the storage class all still gate the patch. Unsupported cases should fail visibly.Open questions for the maintainers:
Tests planned:
walStorage.size: the PVC is patched and the guard still reports the phase.walStorage: the data PVC is resized.If the direction looks right, I'll rework the PR along these lines. If not, I'm happy to close it and write this up as documentation.
JamesatStarling commentedon Nov 24, 2026
@GellertBabel How does the above sound? Does this need to be discussed elsewhere?