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