Fix incorrect assertion bound in WaitForLSN()
authorAlexander Korotkov <[email protected]>
Thu, 4 Dec 2025 08:38:12 +0000 (10:38 +0200)
committerAlexander Korotkov <[email protected]>
Thu, 4 Dec 2025 08:38:12 +0000 (10:38 +0200)
The assertion checking MyProcNumber used MaxBackends as the upper
bound, but the procInfos array is allocated with size
MaxBackends + NUM_AUXILIARY_PROCS. This inconsistency would cause
a false assertion failure if an auxiliary process calls WaitForLSN().

Author: Xuneng Zhou <[email protected]>

src/backend/access/transam/xlogwait.c

index 98aa5f1e4a27cf55bd41455a5e69970aa7778f41..84613fc39c7c25b317031f75a80f19d4ef7a08b0 100644 (file)
@@ -321,7 +321,7 @@ WaitForLSN(WaitLSNType lsnType, XLogRecPtr targetLSN, int64 timeout)
    Assert(waitLSNState);
 
    /* Should have a valid proc number */
-   Assert(MyProcNumber >= 0 && MyProcNumber < MaxBackends);
+   Assert(MyProcNumber >= 0 && MyProcNumber < MaxBackends + NUM_AUXILIARY_PROCS);
 
    if (timeout > 0)
    {