On Wed, Dec 08, 2021 at 04:57:49PM +0530, Bharath Rupireddy wrote:
> Done in the attached v5 patch.

Thanks for the new version.  FWIW, as the information logged when
recovering a WAL segment from the local pg_wal could be rather
confusing at bootstrap phase, I would suggest to simplify things as of
the attached and call it a day.
--
Michael
From 0ab1a0ecdc54272942afbaf523abeff249071e8c Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@paquier.xyz>
Date: Thu, 9 Dec 2021 11:23:42 +0900
Subject: [PATCH v6] add log messages for recovery

---
 src/backend/access/transam/xlog.c        | 22 +++++++++++++++++++++-
 src/backend/access/transam/xlogarchive.c |  2 +-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index d894af310a..3a98ee6c3b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -3787,6 +3787,10 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
 					 xlogfname);
 			set_ps_display(activitymsg);
 
+			ereport(LOG,
+					(errmsg("waiting for WAL segment \"%s\" from archive",
+							xlogfname)));
+
 			if (!RestoreArchivedFile(path, xlogfname,
 									 "RECOVERYXLOG",
 									 wal_segment_size,
@@ -3829,6 +3833,23 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli,
 				 xlogfname);
 		set_ps_display(activitymsg);
 
+		switch (source)
+		{
+			case XLOG_FROM_ARCHIVE:
+				ereport(LOG,
+						(errmsg("recovering WAL segment \"%s\" from archive",
+								xlogfname)));
+				break;
+			case XLOG_FROM_STREAM:
+				ereport(LOG,
+						(errmsg("recovering WAL segment \"%s\" from stream",
+								xlogfname)));
+				break;
+			case XLOG_FROM_PG_WAL:
+			case XLOG_FROM_ANY:
+				break;
+		}
+
 		/* Track source of data in assorted state variables */
 		readSource = source;
 		XLogReceiptSource = source;
@@ -3919,7 +3940,6 @@ XLogFileReadAnyTLI(XLogSegNo segno, int emode, XLogSource source)
 							  XLOG_FROM_ARCHIVE, true);
 			if (fd != -1)
 			{
-				elog(DEBUG1, "got WAL segment from archive");
 				if (!expectedTLEs)
 					expectedTLEs = tles;
 				return fd;
diff --git a/src/backend/access/transam/xlogarchive.c b/src/backend/access/transam/xlogarchive.c
index 4ddeac1fb9..1f724f4acf 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -214,7 +214,7 @@ RestoreArchivedFile(char *path, const char *xlogfname,
 			else
 			{
 				ereport(LOG,
-						(errmsg("restored log file \"%s\" from archive",
+						(errmsg("restored WAL segment \"%s\" from archive",
 								xlogfname)));
 				strcpy(path, xlogpath);
 				return true;
-- 
2.34.1

Attachment: signature.asc
Description: PGP signature

Reply via email to