Re: Possible crash on standby - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Possible crash on standby
Date
Msg-id 20220909171835.GA2255629@nathanxps13
Whole thread Raw
In response to Possible crash on standby  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
On Fri, Sep 09, 2022 at 05:29:49PM +0900, Kyotaro Horiguchi wrote:
> This is because WaitForWALToBecomeAvailable doesn't call
> XLogSHutdownWalRcv() when walreceiver has been stopped before we reach
> the WalRcvStreaming() call cited above. But we need to set
> InstasllXLogFileSegmentActive to false even in that case, since no one
> other than startup process does that.

Nice find.

> Unconditionally calling XLogShutdownWalRcv() fixes it. I feel we might
> need to correct the dependencies between the flag and walreceiver
> state, but it not mandatory because XLogShutdownWalRcv() is designed
> so that it can be called even after walreceiver is stopped.  I don't
> have a clear memory about why we do that at the time, though, but
> recovery check runs successfully with this.

I suppose the alternative would be to set InstallXLogFileSegmentActive to
false in an 'else' block, but that doesn't seem necessary if
XLogShutdownWalRcv() is safe to call unconditionally.  So, unless there is
a bigger problem that I'm not seeing, +1 for your patch.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: is_superuser is not documented
Next
From: Robert Haas
Date:
Subject: Re: Error "initial slot snapshot too large" in create replication slot