Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 217919d
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7deb40a
Choose a head ref
  • 3 commits
  • 17 files changed
  • 2 contributors

Commits on Feb 18, 2025

  1. Introduce inactive_timeout based replication slot invalidation

    Tools that create replication slots (e.g., for migrations or upgrades) may
    fail to remove them if an error occurs, leaving behind unused slots that
    take up space and resources. Manually cleaning them up can be tedious and
    error-prone, and without intervention, these lingering slots can cause
    unnecessary WAL retention and system bloat.
    
    Till now, postgres has the ability to invalidate inactive replication slots
    based on the amount of WAL (set via max_slot_wal_keep_size GUC) that will
    be needed for the slots in case they become active. However, setting an
    optimal value for this is tricky since the amount of WAL a database
    generates, and the allocated storage per instance will vary greatly in
    production. A high value may allow orphaned slots to persist longer than
    necessary, leading to system bloat by retaining WAL unnecessarily.
    
    This commit introduces idle_replication_slot_timeout, a simpler and more
    intuitive way to manage inactive slots. Instead of relying on WAL size,
    users can set a time limit (e.g., 1 or 2 or n days), after which slots that
    remain idle for longer than this amount of time are automatically
    invalidated during checkpoints.
    
    Note that the idle timeout invalidation mechanism is not applicable
    for slots that do not reserve WAL or for slots on the standby server
    that are being synced from the primary server (i.e., standby slots
    having 'synced' field 'true'). Synced slots are always considered to be
    inactive because they don't perform logical decoding to produce changes.
    nishamoond authored and Commitfest Bot committed Feb 18, 2025
    Configuration menu
    Copy the full SHA
    0c56c61 View commit details
    Browse the repository at this point in the history
  2. Add TAP test for slot invalidation based on inactive timeout.

    This test uses injection points to bypass the time overhead caused by the
    idle_replication_slot_timeout GUC, which has a minimum value of one minute.
    nishamoond authored and Commitfest Bot committed Feb 18, 2025
    Configuration menu
    Copy the full SHA
    3a48575 View commit details
    Browse the repository at this point in the history
  3. [CF 52/4770] v79 - Introduce XID age and inactive timeout based repli…

    …cation slot invalidation
    
    This commit was automatically generated by a robot at cfbot.cputube.org.
    It is based on patches submitted to the PostgreSQL mailing lists and
    registered in the PostgreSQL Commitfest application.
    
    This branch will be overwritten each time a new patch version is posted to
    the email thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Commitfest entry: https://commitfest.postgresql.org/52/4770
    Patch(es): https://www.postgresql.org/message-id/CABdArM7v0N0Kz1x0HjnuJZgDC8e=ZGgfCgSywsm4imgmpWghDA@mail.gmail.com
    Author(s):
    Commitfest Bot committed Feb 18, 2025
    Configuration menu
    Copy the full SHA
    7deb40a View commit details
    Browse the repository at this point in the history
Loading