Re: Assertion failure in WaitForWALToBecomeAvailable state machine

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: noah@leadboat.com, michael@paquier.xyz, dilipbalaut@gmail.com, pgsql-hackers@lists.postgresql.org
Date: 2022-09-15T10:25:54Z
Lists: pgsql-hackers
On Tue, Sep 13, 2022 at 3:56 PM Kyotaro Horiguchi
<horikyota.ntt@gmail.com> wrote:
>
> > is that XLogShutdownWalRcv() does a bunch of work via ShutdownWalRcv()
> > - it calls ConditionVariablePrepareToSleep(),
>
> Anyway the code path is executed in almost all cases because the same
> assertion fires otherwise. So I don't see a problem if we do the bunch
> of synchronization things also in that rare case.  I'm not sure we
> want to do [3].

IMO, we don't need to let ShutdownWalRcv() to do extra work of
ConditionVariablePrepareToSleep() - WalRcvRunning() -
ConditionVariableCancelSleep() for WALRCV_STOPPED cases when we know
the walreceiver status before - even though it doesn't have any
problems per se and at that place in the code the WALRCV_STOPPED cases
are more frequent than any other walreceiver cases.

Having said that, let's also hear from other hackers.

-- 
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



Commits

  1. Reset InstallXLogFileSegmentActive after walreceiver self-initiated exit.

  2. Skip WAL recycling and preallocation during archive recovery.