Skip to content

[Docs]: WAL disk running out and dealing with it #8791

Closed as not planned
Closed as not planned

Description

@petterroea

Is there an existing issue already for your request/idea?

  • I have searched for an existing issue, and could not find anything. I believe this is a new documentation enhancement to be evaluated.

What problem in the existing documentation this issue aims to solve?

This is the second time a CNPG cluster I have ran, ran out of WAL disk space. First cluster is running on private metal with limited disk, so I had to be stingy on disk. Second time was just not expecting the WAL to grow that big.

The docs state that expanding the disk is all you need, but in 2 of 2 cases this hasn't been sufficient, and I have had to restore the cluster from backup or delete the primary node+disk so cnpg would remove it as primary, and let it re-sync. See https://cloudnative-pg.io/documentation/current/troubleshooting/#storage-is-full

In practice what happens is that after the WAL is increased, the psql server bootloops with errors like:

psql requested starting point 47/D6000000 is ahead of the WAL flush position of this server 47/D1007798

Describe what additions need to be done to the documentation

It would be nice to have more information about recovering from these kinds of issues, as in my experience they are common.

Describe what pages need to change in the documentation, if any

https://cloudnative-pg.io/documentation/current/troubleshooting/#storage-is-full

Describe what pages need to be removed from the documentation, if any

No response

Additional context

No response

Backport?

Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    triage
    on Oct 8, 2025
  2. zoe-tek commented on Oct 8, 2025

    @zoe-tek

    If expanding the disk did not fix it then the DBs were already too far out of sync from the remaining WAL files.
    What i would do is delete the replica PVCs and pod associated one at a time.
    That will force the replica pod to copy the full DB on creation.

  3. petterroea commented on Oct 9, 2025

    @petterroea
    Author

    If expanding the disk did not fix it then the DBs were already too far out of sync from the remaining WAL files. What i would do is delete the replica PVCs and pod associated one at a time. That will force the replica pod to copy the full DB on creation.

    That is what I ended up doing in the most recent case, but it would be nice if the docs recommended this if it is the best approach. Or warned about it and recommended a better way, if it was dangerous.

  4. petterroea commented on Oct 9, 2025

    @petterroea
    Author

    Deleting PV's with prod data is.... scary 😅

  5. zoe-tek commented on Oct 9, 2025

    @zoe-tek

    I am wanting to add that process to the docs, need to ask where it should go, i was thinking at the bottom of the storage page and a link it different sections as it is the same process for changing the storage type. @petterroea i was told that they didn't want to recommend that process but that it is a way to recover without having to restore from a backup and they do have a section for Re-creating Storage

    It can be scary and that's why having backups is important. I have done this process over 50 times where i work, 1 mass cluster migration of 30 after creating a database storage type and random ones for clusters that their 2nd and 3rd pods fail after either network or other issues and I haven't lost any data yet.

  6. petterroea commented on Oct 9, 2025

    @petterroea
    Author

    That's a relief!

  7. iharw commented on Oct 31, 2025

    @iharw

    Hi @petterroea We faced a similar issue.
    Our environment runs CloudNativePG on RKE2 (bare-metal) using Longhorn as the default storage class.
    During periods of high transaction activity, the WAL volume filled up quickly and Longhorn did not release the used space properly because of its copy-on-write design and internal snapshot behavior.
    This caused WAL usage to keep growing until we hit a full-disk outage.

    We resolved the issue by using a local-path storage class specifically for WAL (while keeping Longhorn for main data).
    We also applied node affinity to ensure the WAL pod is rescheduled to the same node, maintaining data locality.

    Since then, WAL growth has been stable and the issue is fully resolved.

    example
    walStorage:
    resizeInUseVolumes: true
    size: 10Gi
    storageClass: local-path

    spec:
    affinity:
    nodeAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
    - preference:
    matchExpressions:
    - key: cnpg-instance
    operator: In
    values:
    - '1'
    - '2'
    - '3'
    weight: 100
    requiredDuringSchedulingIgnoredDuringExecution:
    nodeSelectorTerms:
    - matchExpressions:
    - key: node-role.kubernetes.io/worker
    operator: Exists
    podAntiAffinityType: preferred

  8. Sierra1011 commented on Dec 13, 2025

    @Sierra1011

    Potentially another case of Longhorn causing WAL space exhaustion here; in my case I'm on Talos and after faffing around trying to make local-path-provisioner work for a length of time measured in days, I gave up because I was just tired of it.

    I'll try and fix it, I'd love to have clusters in-cluster but in the short term I just need it to work so back to a Postgres VM it is 🤷

  9. petterroea commented on Dec 13, 2025

    @petterroea
    Author

    Interesting. I'm not having any such issues, but I use EBS at work and rook at home. LocalStorage is an interesting solution, but I would then be afraid of accidentally filling the entire disk, which could cause other issues such as logs not being written. This could make debugging an outage worse or even act as a red herring, so this worries me.

  10. petterroea commented on Dec 13, 2025

    @petterroea
    Author

    Actually, I have seen something similar before, since I made this issue:

    Image This screenshot shows the available disk space on PVCs in a Namespace with CNPG. The line pointed to by an arrow is multiple WALs that suddenly started filling up with no obvious explanation, until they died.

    There was no increased traffic or anything that could have explained this behavior, and as you can see, no other node started behaving like that when the failover happened, so it seems like an isolated issue?

    Here is a close-up:

    Image

    Note that multiple WALs decreased at the same rate. The constant 10GiB volumes are the actual non-WAL storage. The dots is from one of the WALs that were only registered intermittently. Something was up. I believe restarting the pods fixed it?

    This is on EKS. Not sure if this is relevant to the issue, but this is how WAL exhaustion can look like

  11. github-actions commented on Feb 12, 2026

    @github-actions
    Contributor

    This issue is stale because it has been open for 60 days with no activity.

  12. pravorskyi commented on Apr 15, 2026

    @pravorskyi

    It's not the stale, I'm facing same issue.
    Database is 49 megabytes, and WAL become absurdly 29 Gb in one week!

  13. 4pack commented on May 5, 2026

    @4pack

    I can also confirm this as an issue. A 600 megabyte database fills a 30 GB PV way too quickly. In my case, it's only a one of the database pods.

    I'm using rook-ceph for my storage backend.

    These pods are acting normally.

    Image Image

    This one is the problem pod.

    Image
  14. hugosxm commented on May 19, 2026

    @hugosxm

    I have the same issue, sometime I will see a prometheus alert for a pvc growing on the cnpg cluster, it is always the replicas, and what I do is cnpg destroy cluster_name pod_number. Then it recreates a brand new replica and do a fresh sync. But if there is a better way... because a cluster starting like this :

    database-1
    database-2
    database-3
    

    Is becomming

    database-7
    database-8
    database-9 
    

    with time ^^

    EDIT : of course I check that I am not running destroy command on the current primary... You have to check with cnpg status before !

  15. nitekon1 commented on Aug 11, 2026

    @nitekon1

    Adding a data point from a production incident on CNPG v1.30.0 (OLM install on OpenShift 4.x, CSI RBD storage with allowVolumeExpansion: true / resizeInUseVolumes: true) that might be useful for whatever recovery guidance ends up in the docs here, since it narrows down what actually needs manual intervention.

    Our primary's WAL volume filled (WAL archiving had been failing for an unrelated environment reason, so WAL accumulated until the volume filled) and its instance-manager became unreachable. Patching .spec.walStorage.size on the Cluster resource did not propagate to any PVC in the group — including the two healthy replicas' WAL PVCs, which were not disk-constrained and whose instance-managers stayed reachable throughout. That suggests the reconciler's PVC-sizing path is gated on the one unreachable instance rather than scoped per-instance.

    Recovery only required patching the failing instance's PVC directly:

    kubectl patch pvc <wal-pvc-name> -n <namespace> --type merge \
      -p '{"spec":{"resources":{"requests":{"storage":"<new-size>"}}}}'
    

    to let the CSI resizer act independently of the operator. Once that instance came back to Ready, the operator resumed normal reconciliation on its own and expanded the other two replicas' PVCs with no further manual patching needed.

    Might be worth a line in whatever recovery doc comes out of this: an administrator only needs to hand-patch the PVC belonging to the stuck instance — the rest of the group self-heals once the operator is unblocked, no need to patch every PVC in the cluster by hand.

  16. github-actions commented on Oct 20, 2026

    @github-actions
    Contributor

    This issue is stale because it has been open for 60 days with no activity.

  17. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

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

Metadata

Metadata

Assignees

Labels

Staletriage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions