postgres.git / summary / log / commit / refs

commit    f2d6392e199256dd4a37bebbc92a2d28fac45b5f
Author:   Alexander Korotkov <akorotkov@postgresql.org>
Date:     Tue Aug 18 11:26:38 2026 +0000

    Clarify LSN waiter cleanup after wakeup
    
    WaitLSNWakeup() can be called by several processes, not only the startup
    process.  Update the cleanup comment to explain that another process may
    remove the waiter before waking it and that inHeap prevents double
    deletion.
    
    Author: Xuneng Zhou <xunengzhou@gmail.com>
    Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
    Discussion: https://postgr.es/m/CABPTF7UtW_cAa%3DQh4RDfKiUqu3pJJE22ai9tbWJVERbeRyssLw%40mail.gmail.com
    Backpatch-through: 19


src/backend/access/transam/xlogwait.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/access/transam/xlogwait.c b/src/backend/access/transam/xlogwait.c index 5ff1d4fcd70..b82f64df65a 100644 --- a/src/backend/access/transam/xlogwait.c +++ b/src/backend/access/transam/xlogwait.c @@ -524,9 +524,10 @@ WaitForLSN(WaitLSNType lsnType, XLogRecPtr targetLSN, int64 timeout) } /* - * Delete our process from the shared memory heap. We might already be - * deleted by the startup process. The 'inHeap' flags prevents us from - * the double deletion. + * A progress waker, such as the startup process during WAL replay, may + * already have removed this waiter through WaitLSNWakeup() before setting + * its latch. The inHeap flag makes this cleanup safe whether or not the + * entry remains in the heap. */ deleteLSNWaiter(lsnType); [parent: 58c48b4ec425]