On Wed, Feb 2, 2011 at 17:43, Heikki Linnakangas
<heikki.linnakan...@enterprisedb.com> wrote:
> On 02.02.2011 16:36, Magnus Hagander wrote:
>>
>> When running pg_basebackup with -x to include all transaction log, the
>> server will still throw a warning about xlog archiving if it's not
>> enabled - that is completely irrelevant since pg_basebackup has
>> included it already (and if it was gone, the base backup step itself
>> will fail - actual error and not warning).
>>
>> This patch moves the warning from do_pg_base_backup to pg_base_backup,
>> so it still shows when using the explicit function calls, but goes
>> away when using pg_basebackup.
>
> For the sake of consistency, how about moving the "pg_stop_backup complete,
> all required WAL segments have been archived" notice too?

Well, it goes out as a NOTICE, so by default it doesn't show.. But
yeah, for code-consistency it makes sense. Like so, then.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 66cc004..d7559b8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8619,6 +8619,14 @@ pg_stop_backup(PG_FUNCTION_ARGS)
 
 	snprintf(stopxlogstr, sizeof(stopxlogstr), "%X/%X",
 			 stoppoint.xlogid, stoppoint.xrecoff);
+
+	if (XLogArchivingActive())
+		ereport(NOTICE,
+				(errmsg("pg_stop_backup complete, all required WAL segments have been archived")));
+	else
+		ereport(NOTICE,
+				(errmsg("WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup")));
+
 	PG_RETURN_TEXT_P(cstring_to_text(stopxlogstr));
 }
 
@@ -8866,13 +8874,7 @@ do_pg_stop_backup(char *labelfile)
 								 "but the database backup will not be usable without all the WAL segments.")));
 			}
 		}
-
-		ereport(NOTICE,
-				(errmsg("pg_stop_backup complete, all required WAL segments have been archived")));
 	}
-	else
-		ereport(NOTICE,
-				(errmsg("WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup")));
 
 	/*
 	 * We're done.  As a convenience, return the ending WAL location.
-- 
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