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: cf/5479~1
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: cf/5479
Choose a head ref
  • 2 commits
  • 46 files changed
  • 2 contributors

Commits on Nov 6, 2025

  1. Toggle logical decoding dynamically based on logical slot presence.

    Previously logical decoding required wal_level to be set to 'logical'
    at server start. This commit adds functionality to automatically
    control logical decoding availability based on logical replication
    slot presence.
    
    The newly introduced module logicalctl.c allows logical decoding to be
    dynamically activated when needed when wal_level is set to
    'replica'. When the first logical replication slot is created, the
    system automatically increases the effective WAL level to maintain
    logical-level WAL records. Conversely, after the last logical slot is
    dropped or invalidated, it decreases back to 'replica' WAL level.
    
    A new read-only GUC parameter effective_wal_level is introduced to
    monitor the actual WAL level in effect. This parameter reflects the
    current operational WAL level, which may differ from the configured
    wal_level setting.
    
    While activation occurs synchronously right after creating the first
    logical slot, deactivation happens asynchronously through the
    checkpointer process. This design choice exists because deactivation
    requires waiting for concurrent attempts to update logical decoding
    status, which can be problematic when the process is holding
    interrupts. This situation arises when a process cleans up temporary
    or ephemeral slots on error or at process exit without releasing
    temporary slots explicitly. This lazy approach has a drawback: it may
    take longer to change the effective_wal_level and disable logical
    decoding, especially when the checkpointer is busy with other
    tasks. However, since dropping the last slot should not happen
    frequently, we chose this approach in all deactivation cases for
    simpler code implementation for simplicity, even though the lazy
    approach is required only in error cases or at process exit time in
    principle. In the future, we could address this limitation either by
    using a dedicated worker instead of the checkpointer, or by
    implementing synchronous waiting during slot drops if workloads are
    significantly affected by the lazy deactivation of logical decoding.
    
    XXX Bump PG_CONTROL_VERSION as it adds a new field to CheckPoint
    struct.
    
    Reviewed-by: Shveta Malik <[email protected]>
    Reviewed-by: Shlok Kyal <[email protected]>
    Reviewed-by: Bertrand Drouvot <[email protected]>
    Reviewed-by: Amit Kapila <[email protected]>
    Reviewed-by: Hayato Kuroda <[email protected]>
    Reviewed-by: Ashutosh Bapat <[email protected]>
    Discussion: https://postgr.es/m/CAD21AoCVLeLYq09pQPaWs+Jwdni5FuJ8v2jgq-u9_uFbcp6UbA@mail.gmail.com
    MasahikoSawada authored and Commitfest Bot committed Nov 6, 2025
    Configuration menu
    Copy the full SHA
    eacce91 View commit details
    Browse the repository at this point in the history
  2. [CF 5479] v24 - Enable logical decoding when wal_level = 'replica' wi…

    …thout a server restart
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5479
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/CAD21AoB+xpZ-+_=Zkj_RRcGk8gexkt3Sx3eLBBeWVpUqOHGvBg@mail.gmail.com
    Author(s): Masahiko Sawada
    Commitfest Bot committed Nov 6, 2025
    Configuration menu
    Copy the full SHA
    70f087c View commit details
    Browse the repository at this point in the history
Loading