Skip to content

[Feature]: Prevent replication slots from consuming all WAL storage by default #10839

Closed as not planned

Description

@JohnStarich

Is there an existing issue already for this feature request/idea?

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

What problem is this feature going to solve? Why should it be added?

I have had to repeatedly take recovery actions on several of my Clusters, and in some cases restore from backup, due to running out of WAL space on disk. It got to the point I was seeing all clusters eventually fall apart after only a couple days with very light usage. Very similar symptoms to the ones I see described in #8791.

Eventually I stumbled upon this subsection (added originally here). While it's great this is documented and I eventually found it, I feel like this was kinda buried near the bottom of the page.

I am surprised to find this option is not set to something less hazardous by default. It would seem the Postgres docs and wider community agree it should not be set to the default (-1). Of course, there's probably tradeoffs I do not fully understand yet.

Related: #2671

Describe the solution you'd like

I would love to see an improved default setting for max_slot_wal_keep_size to prevent runaway WAL volume disk consumption. I use almost entirely default settings, and found it surprising my cluster could degrade so rapidly with default replication settings.

Doc improvements would also be welcome, but should already be covered by #8791.

Describe alternatives you've considered

One alternative might be to better surface this parameter as a likely solution for replicated clusters in the Cluster's status message. Or perhaps a warning emitted as an Event.

Additional context

For context, I previously used this for all of my cluster configurations (only major version and volume size varies per app):

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: foo
  namespace: bar
spec:
  imageCatalogRef:
    apiGroup: postgresql.cnpg.io
    kind: ClusterImageCatalog
    name: postgresql
    major: 18
  instances: 3
  bootstrap:
    initdb:
  storage:
    storageClass: baz
    size: 20Gi
  affinity:
    podAntiAffinityType: required
  backup:
    volumeSnapshot:
      className: biff
  postgresql:
    ## Inserting this resolved my runaway disk consumption:
    #parameters:
    #  max_slot_wal_keep_size: 10GB
    synchronous:
      method: any
      number: 1
      failoverQuorum: true

and inserted the commented parameter to resolve it.

And of course an obligatory thank you for improving and maintaining this excellent operator. I've been so incredibly pleased with the user experience you've all created here.
Please let me know how I can help.

Backport?

No

Are you willing to actively contribute to this feature?

Yes

Code of Conduct

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

Activity

  1. added
    triage
    on Jun 5, 2026
  2. JohnStarich commented on Jun 5, 2026

    @JohnStarich
    Author

    Copying a little bit from here:

    ... (for example, automatically set it to 90% of the WAL volume size, or for example total WAL volume size - x * WAL segment size where x could be 10 by default, or somehow related to min/max WAL size options).

    Do you think this might still be feasible?

  3. JohnStarich commented on Jun 9, 2026

    @JohnStarich
    Author

    Ah, apparently this doesn't completely resolve my issue. Dang.

    It does seem to help prevent more degradation when 1 of 3 replicas becomes stuck on a forked timeline and can't resolve for extended periods of time though. This means I can at least recover more easily!

  4. github-actions commented on Aug 9, 2026

    @github-actions
    Contributor

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

  5. github-actions commented on Aug 24, 2026

    @github-actions
    Contributor

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

  6. JohnStarich commented on Aug 24, 2026

    @JohnStarich
    Author

    Could we please reopen this one? It would still be a very helpful improvement to default convention over configuration.

    I’ve since verified this did completely resolve my volume consumption issues.

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