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/5550~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/5550
Choose a head ref
  • 4 commits
  • 30 files changed
  • 4 contributors

Commits on Oct 23, 2025

  1. Add pairingheap_initialize() for shared memory usage

    The existing pairingheap_allocate() uses palloc(), which allocates
    from process-local memory. For shared memory use cases, the pairingheap
    structure must be allocated via ShmemAlloc() or embedded in a shared
    memory struct. Add pairingheap_initialize() to initialize an already-
    allocated pairingheap structure in-place, enabling shared memory usage.
    
    Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.com
    Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
    Author: Kartyshov Ivan <[email protected]>
    Author: Alexander Korotkov <[email protected]>
    Reviewed-by: Michael Paquier <[email protected]>
    Reviewed-by: Peter Eisentraut <[email protected]>
    Reviewed-by: Dilip Kumar <[email protected]>
    Reviewed-by: Amit Kapila <[email protected]>
    Reviewed-by: Alexander Lakhin <[email protected]>
    Reviewed-by: Bharath Rupireddy <[email protected]>
    Reviewed-by: Euler Taveira <[email protected]>
    Reviewed-by: Heikki Linnakangas <[email protected]>
    Reviewed-by: Kyotaro Horiguchi <[email protected]>
    Reviewed-by: Xuneng Zhou <[email protected]>
    alterego655 authored and Commitfest Bot committed Oct 23, 2025
    Configuration menu
    Copy the full SHA
    518c950 View commit details
    Browse the repository at this point in the history
  2. Add infrastructure for efficient LSN waiting

    Implement a new facility that allows processes to wait for WAL to reach
    specific LSNs, both on primary (waiting for flush) and standby (waiting
    for replay) servers.
    
    The implementation uses shared memory with per-backend information
    organized into pairing heaps, allowing O(1) access to the minimum
    waited LSN. This enables fast-path checks: after replaying or flushing
    WAL, the startup process or WAL writer can quickly determine if any
    waiters need to be awakened.
    
    Key components:
    - New xlogwait.c/h module with WaitForLSNReplay() and WaitForLSNFlush()
    - Separate pairing heaps for replay and flush waiters
    - WaitLSN lightweight lock for coordinating shared state
    - Wait events WAIT_FOR_WAL_REPLAY and WAIT_FOR_WAL_FLUSH for monitoring
    
    This infrastructure can be used by features that need to wait for WAL
    operations to complete.
    
    Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.com
    Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
    Author: Kartyshov Ivan <[email protected]>
    Author: Alexander Korotkov <[email protected]>
    Author: Xuneng Zhou <[email protected]>
    Reviewed-by: Michael Paquier <[email protected]>
    Reviewed-by: Peter Eisentraut <[email protected]>
    Reviewed-by: Dilip Kumar <[email protected]>
    Reviewed-by: Amit Kapila <[email protected]>
    Reviewed-by: Alexander Lakhin <[email protected]>
    Reviewed-by: Bharath Rupireddy <[email protected]>
    Reviewed-by: Euler Taveira <[email protected]>
    Reviewed-by: Heikki Linnakangas <[email protected]>
    Reviewed-by: Kyotaro Horiguchi <[email protected]>
    akorotkov authored and Commitfest Bot committed Oct 23, 2025
    Configuration menu
    Copy the full SHA
    24e157c View commit details
    Browse the repository at this point in the history
  3. Implement WAIT FOR command

    WAIT FOR is to be used on standby and specifies waiting for
    the specific WAL location to be replayed.  This option is useful when
    the user makes some data changes on primary and needs a guarantee to see
    these changes are on standby.
    
    WAIT FOR needs to wait without any snapshot held.  Otherwise, the snapshot
    could prevent the replay of WAL records, implying a kind of self-deadlock.
    This is why separate utility command seems appears to be the most robust
    way to implement this functionality.  It's not possible to implement this as
    a function.  Previous experience shows that stored procedures also have
    limitation in this aspect.
    
    Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.com
    Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
    Author: Kartyshov Ivan <[email protected]>
    Author: Alexander Korotkov <[email protected]>
    Co-authored-by: Xuneng Zhou <[email protected]>
    Reviewed-by: Michael Paquier <[email protected]>
    Reviewed-by: Peter Eisentraut <[email protected]>
    Reviewed-by: Dilip Kumar <[email protected]>
    Reviewed-by: Amit Kapila <[email protected]>
    Reviewed-by: Alexander Lakhin <[email protected]>
    Reviewed-by: Bharath Rupireddy <[email protected]>
    Reviewed-by: Euler Taveira <[email protected]>
    Reviewed-by: Heikki Linnakangas <[email protected]>
    Reviewed-by: Kyotaro Horiguchi <[email protected]>
    Reviewed-by: jian he <[email protected]>
    Reviewed-by: Álvaro Herrera <[email protected]>
    2 people authored and Commitfest Bot committed Oct 23, 2025
    Configuration menu
    Copy the full SHA
    024483b View commit details
    Browse the repository at this point in the history
  4. [CF 5550] v17 - Waiting for LSN replay with WAIT FOR command

    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5550
    
    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/CAPpHfdtKJqK_gDrqVGH-oq36UNp2FV2Gh0pYDHTCE0gDUjMKfw@mail.gmail.com
    Author(s): Alexander Korotkov, Xuneng Zhou
    Commitfest Bot committed Oct 23, 2025
    Configuration menu
    Copy the full SHA
    4f10843 View commit details
    Browse the repository at this point in the history
Loading