restored_from_xlog.v1.patch

text/x-patch

Filename: restored_from_xlog.v1.patch
Type: text/x-patch
Part: 0
Message: Re: log messages for archive recovery progress

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
Series: patch v1
File+
src/backend/access/transam/xlog.c 10 3
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 8e65962..055ae6d 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -2817,6 +2817,16 @@ XLogFileRead(uint32 log, uint32 seg, int emode, TimeLineID tli,
 				 xlogfname);
 		set_ps_display(activitymsg, false);
 
+		/*
+		 * If we're in archive recovery and the archive runs dry,
+		 * we switch to reading from the pg_xlog directly. In that case
+		 * we want to output a message that shows what just happened.
+		 */
+		if (InArchiveRecovery && source == XLOG_FROM_PG_XLOG)
+			ereport(LOG,
+					(errmsg("restored log file \"%s\" from pg_xlog",
+							xlogfname)));
+
 		/* Track source of data in assorted state variables */
 		readSource = source;
 		XLogReceiptSource = source;
@@ -2867,10 +2877,7 @@ XLogFileReadAnyTLI(uint32 log, uint32 seg, int emode, int sources)
 		{
 			fd = XLogFileRead(log, seg, emode, tli, XLOG_FROM_ARCHIVE, true);
 			if (fd != -1)
-			{
-				elog(DEBUG1, "got WAL segment from archive");
 				return fd;
-			}
 		}
 
 		if (sources & XLOG_FROM_PG_XLOG)