Thanks to visit codestin.com
Credit goes to github.com

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/6265~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/6265
Choose a head ref
  • 5 commits
  • 11 files changed
  • 2 contributors

Commits on Dec 26, 2025

  1. Extend xlogwait infrastructure with write and flush wait types

    Add support for waiting on WAL write and flush LSNs in addition to the
    existing replay LSN wait type. This provides the foundation for
    extending the WAIT FOR command with MODE option.
    
    Key changes:
    - Add WAIT_LSN_TYPE_STANDBY_WRITE and WAIT_LSN_TYPE_STANDBY_FLUSH to WaitLSNType
    - Add GetCurrentLSNForWaitType() to retrieve current LSN for each wait type
    - Add new wait events WAIT_EVENT_WAIT_FOR_WAL_WRITE and
      WAIT_EVENT_WAIT_FOR_WAL_FLUSH for pg_stat_activity visibility
    - Update WaitForLSN() to use GetCurrentLSNForWaitType() internally
    alterego655 authored and Commitfest Bot committed Dec 26, 2025
    Configuration menu
    Copy the full SHA
    4e9097d View commit details
    Browse the repository at this point in the history
  2. Add MODE option to WAIT FOR LSN command

    Extend the WAIT FOR LSN command with an optional MODE option in the
    WITH clause that specifies which LSN type to wait for:
    
      WAIT FOR LSN '<lsn>' [WITH (MODE '<mode>', ...)]
    
    where mode can be:
    - 'standby_replay' (default): Wait for WAL to be replayed to the specified LSN
    - 'standby_write': Wait for WAL to be written (received) to the specified LSN
    - 'standby_flush': Wait for WAL to be flushed to disk at the specified LSN
    - 'primary_flush': Wait for WAL to be flushed to disk on the primary server
    
    The default mode is 'standby_replay', matching the original behavior when MODE
    is not specified. This follows the pattern used by COPY and EXPLAIN
    commands where options are specified as string values in the WITH clause.
    
    Modes are explicitly named to distinguish between primary and standby operations:
    - Standby modes ('standby_replay', 'standby_write', 'standby_flush') can only
      be used during recovery (on a standby server)
    - Primary mode ('primary_flush') can only be used on a primary server
    
    The 'standby_write' and 'standby_flush' modes are useful for scenarios where
    applications need to ensure WAL has been received or persisted on the standby
    without necessarily waiting for replay to complete. The 'primary_flush' mode
    allows waiting for WAL to be flushed on the primary server.
    
    Also includes:
    - Documentation updates for the new syntax and mode descriptions
    - Test coverage for all four modes including error cases and concurrent waiters
    - Wakeup logic in walreceiver for standby write/flush waiters
    - Wakeup logic in WAL writer for primary flush waiters
    alterego655 authored and Commitfest Bot committed Dec 26, 2025
    Configuration menu
    Copy the full SHA
    d9d68dc View commit details
    Browse the repository at this point in the history
  3. Add tab completion for WAIT FOR LSN MODE option

    Update psql tab completion to support the optional MODE option in
    WAIT FOR LSN command. After specifying an LSN value, completion now
    offers both MODE and WITH keywords. The MODE option controls whether
    the wait is evaluated from the standby or primary perspective.
    
    When MODE is specified, completion suggests the valid mode values:
    standby_replay, standby_write, standby_flush, and primary_flush.
    alterego655 authored and Commitfest Bot committed Dec 26, 2025
    Configuration menu
    Copy the full SHA
    5861122 View commit details
    Browse the repository at this point in the history
  4. Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()

    When the standby is passed as a PostgreSQL::Test::Cluster instance,
    use the WAIT FOR LSN command on the standby server to implement
    wait_for_catchup() for replay, write, and flush modes.  This is more
    efficient than polling pg_stat_replication on the upstream, as the
    WAIT FOR LSN command uses a latch-based wakeup mechanism.
    
    The optimization applies when:
    - The standby is passed as a Cluster object (not just a name string)
    - The mode is 'replay', 'write', or 'flush' (not 'sent')
    - The standby is in recovery
    
    For 'sent' mode, when the standby is passed as a string (e.g., a
    subscription name for logical replication), or when the standby has
    been promoted, the function falls back to the original polling-based
    approach using pg_stat_replication on the upstream.
    alterego655 authored and Commitfest Bot committed Dec 26, 2025
    Configuration menu
    Copy the full SHA
    9d0e9bd View commit details
    Browse the repository at this point in the history
  5. [CF 6265] v8 - Add MODE parameter to WAIT FOR LSN command

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/6265
    
    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/CABPTF7WDzTs2EEB6c5QmsV-svF4rKSTLOS1pWM+7ydUN6tnFOQ@mail.gmail.com
    Author(s): Xuneng Zhou
    Commitfest Bot committed Dec 26, 2025
    Configuration menu
    Copy the full SHA
    203ecb4 View commit details
    Browse the repository at this point in the history
Loading