Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Date: 2023-01-03 02:17:31
Message-ID: Y7OQO3tlMen184Ss@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-01-03 02:22:08 Re: CFM for 2023-01
Previous Message Andres Freund 2023-01-03 01:21:53 Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local