postgres-github.git / summary / log / commit / refs

commit    e7cd592174d94f9aea197edc5f0c6f708df27271
Author:   Alexander Korotkov <akorotkov@postgresql.org>
Date:     Sun May 03 13:19:00 2026 +0000

    Wake standby_write/standby_flush waiters from the WAL replay loop
    
    The startup process only woke STANDBY_REPLAY waiters after replaying
    each WAL record. STANDBY_WRITE and STANDBY_FLUSH waiters depended only
    on walreceiver write/flush callbacks. As a result, replay progress alone
    did not wake those waiters, and in pure archive recovery (where no
    walreceiver exists) they could sleep until timeout.
    
    Fix by also calling WaitLSNWakeup() for STANDBY_WRITE and
    STANDBY_FLUSH after each replay. For the replay-floor semantics used by
    GetCurrentLSNForWaitType(), replay progress is a valid lower bound for
    both modes: WAL cannot be replayed unless it has already been written
    and flushed locally.
    
    This works together with the replay-position floor in
    GetCurrentLSNForWaitType(). The getter ensures that a waiter woken by
    replay can recheck successfully; the replay-side wakeups ensure that a
    waiter already asleep is notified when replay reaches its target.
    
    Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
    Discussion: https://postgr.es/m/1957514.1775526774%40sss.pgh.pa.us
    Author: Xuneng Zhou <xunengzhou@gmail.com>
    Reviewed-by: Andres Freund <andres@anarazel.de>
    Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>

[parent: cba67b5b87f9]