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

From Michael Paquier
Subject Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Date
Msg-id Y7OQO3tlMen184Ss@paquier.xyz
Whole thread Raw
In response to Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
List pgsql-hackers
On Fri, Dec 30, 2022 at 10:32:57AM -0800, Nathan Bossart wrote:
> 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.

        case XLOG_FROM_ARCHIVE:
+
+           /*
+            * After failing to read from archive, we try to read from
+            * pg_wal.
+            */
+           currentSource = XLOG_FROM_PG_WAL;
+           break;
In standby mode, the priority lookup order is pg_wal -> archive ->
stream.  With this change, we would do pg_wal -> archive -> pg_wal ->
stream, meaning that it could influence some recovery scenarios while
involving more lookups than necessary to the local pg_wal/ directory?

See, on failure where the current source is XLOG_FROM_ARCHIVE, we
would not switch anymore directly to XLOG_FROM_STREAM.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local
Next
From: Michael Paquier
Date:
Subject: Re: CFM for 2023-01