2012/1/11 Euler Taveira de Oliveira <eu...@timbira.com>:
> On 08-01-2012 11:59, Satoshi Nagayasu / Uptime Technologies, LLC. wrote:
>>> [2011-12-08 15:14:36 JST] 16758: LOG:  restored log file 
>>> "000000080000000000000046" from archive
>>> [2011-12-08 15:14:36 JST] 16758: LOG:  recoverying 000000080000000000000046
>>> [2011-12-08 15:14:36 JST] 16758: LOG:  restored log file 
>>> "000000080000000000000047" from archive
>>> [2011-12-08 15:14:36 JST] 16758: LOG:  recoverying 000000080000000000000047
>>> cp: cannot stat `/backups/archlog/000000080000000000000048': No such file 
>>> or directory
>>> [2011-12-08 15:14:37 JST] 16758: LOG:  could not restore file 
>>> "000000080000000000000048" from archive
>>> [2011-12-08 15:14:37 JST] 16758: LOG:  attempting to look into pg_xlog
>>> [2011-12-08 15:14:37 JST] 16758: LOG:  recoverying 000000080000000000000048
>>
> What about just 'restored log file "000000080000000000000048" from pg_xlog'
> instead of the last two messages? If you can't read from pg_xlog emit 'could
> not restore file "000000080000000000000048" from pg_xlog'.

Yes, simple is better.

We already have a message if the file is not present, we just need one
if we switch to using pg_xlog.

Please look at this.

-- 
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
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)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to