diff options
author | Simon Riggs <simon@2ndQuadrant.com> | 2010-04-18 18:44:53 +0000 |
---|---|---|
committer | Simon Riggs <simon@2ndQuadrant.com> | 2010-04-18 18:44:53 +0000 |
commit | d38603bd974f2befd1f0599a2392849916b2102c (patch) | |
tree | 3953316ae4433181bbe6013e9ee2cf5885932598 /src/backend/access/transam/xlog.c | |
parent | 2847de9df2c8f10b0f44170c373559164d5cef6f (diff) | |
download | postgresql-d38603bd974f2befd1f0599a2392849916b2102c.tar.gz postgresql-d38603bd974f2befd1f0599a2392849916b2102c.zip |
Improve sequence and sense of messages from pg_stop_backup().
Now doesn't report it is waiting until it actually is waiting,
plus message doesn't appear until at least 5 seconds wait, so
we avoid reporting the wait before we've given the archiver
a reasonable time to wake up and archive the file we just
created earlier in the function.
Also add new unconditional message to confirm safe completion.
Now a normal, healthy execution does not report waiting at
all, just safe completion.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 47ebf7d1fe1..9a60cb9cbac 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.399 2010/04/18 18:17:12 sriggs Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.400 2010/04/18 18:44:53 sriggs Exp $ * *------------------------------------------------------------------------- */ @@ -8290,6 +8290,7 @@ pg_stop_backup(PG_FUNCTION_ARGS) int ich; int seconds_before_warning; int waits = 0; + bool reported_waiting = false; if (!superuser()) ereport(ERROR, @@ -8431,9 +8432,6 @@ pg_stop_backup(PG_FUNCTION_ARGS) BackupHistoryFileName(histfilename, ThisTimeLineID, _logId, _logSeg, startpoint.xrecoff % XLogSegSize); - ereport(NOTICE, - (errmsg("pg_stop_backup cleanup done, waiting for required WAL segments to be archived"))); - seconds_before_warning = 60; waits = 0; @@ -8442,6 +8440,13 @@ pg_stop_backup(PG_FUNCTION_ARGS) { CHECK_FOR_INTERRUPTS(); + if (!reported_waiting && waits > 5) + { + ereport(NOTICE, + (errmsg("pg_stop_backup cleanup done, waiting for required WAL segments to be archived"))); + reported_waiting = true; + } + pg_usleep(1000000L); if (++waits >= seconds_before_warning) @@ -8456,6 +8461,9 @@ pg_stop_backup(PG_FUNCTION_ARGS) } } + ereport(NOTICE, + (errmsg("pg_stop_backup complete, all required WAL segments have been archived"))); + /* * We're done. As a convenience, return the ending WAL location. */ |