Fix incorrect assertion bound in WaitForLSN()

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 <xunengzhou@gmail.com>
pull/256/head
Alexander Korotkov 2 weeks ago
parent 6c5c393b74
commit d6ef8ee3ee
  1. 2
      src/backend/access/transam/xlogwait.c

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

Loading…
Cancel
Save