Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable() - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Date
Msg-id 20221230183257.GA437226@nathanxps13
Whole thread Raw
In response to Simplify standby state machine a bit in WaitForWALToBecomeAvailable()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
List pgsql-hackers
On Tue, Oct 18, 2022 at 12:01:07PM +0530, Bharath Rupireddy wrote:
> The attached patch attempts to simplify the code a bit by changing the
> current source to XLOG_FROM_PG_WAL after failing in
> XLOG_FROM_PG_ARCHIVE so that the state machine can move smoothly to
> read from pg_wal. And we can just pass the current source to
> XLogFileReadAnyTLI(). It also enables us to reduce a bit of extra
> XLogFileRead() code in XLogFileReadAnyTLI().

This looks correct to me.  The only thing that stood out to me was the loop
through 'tles' in XLogFileReadyAnyTLI.  With this change, we'd loop through
the timelines for both XLOG_FROM_PG_ARCHIVE and XLOG_FROM_PG_WAL, whereas
now we only loop through the timelines once.  However, I doubt this makes
much difference in practice.  You'd only do the extra loop whenever
restoring from the archives failed.

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



pgsql-hackers by date:

Previous
From: Chong Wang
Date:
Subject: Question about initial logical decoding snapshot
Next
From: Nathan Bossart
Date:
Subject: Re: Add index scan progress to pg_stat_progress_vacuum