Re: pg_stop_backup does not complete

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <greg(at)2ndquadrant(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_stop_backup does not complete
Date: 2010-02-25 02:19:22
Message-ID: 17828.1267064362@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Smith <greg(at)2ndquadrant(dot)com> writes:
> Tom Lane wrote:
>> The value of the HINT I think would be to make them (a) not afraid to
>> hit control-C and (b) aware of the fact that their archiver has got
>> a problem.
>>
> Agreed on both points. Patch attached that implements something similar
> to Josh's wording, tweaking the original warning too.

OK, everyone likes the immediate NOTICE. I did a bit of copy-editing
and committed the attached version.

regards, tom lane

Index: xlog.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v
retrieving revision 1.377
diff -c -r1.377 xlog.c
*** xlog.c 19 Feb 2010 10:51:03 -0000 1.377
--- xlog.c 25 Feb 2010 02:15:49 -0000
***************
*** 8132,8138 ****
*
* We wait forever, since archive_command is supposed to work and we
* assume the admin wanted his backup to work completely. If you don't
! * wish to wait, you can set statement_timeout.
*/
XLByteToPrevSeg(stoppoint, _logId, _logSeg);
XLogFileName(lastxlogfilename, ThisTimeLineID, _logId, _logSeg);
--- 8132,8139 ----
*
* We wait forever, since archive_command is supposed to work and we
* assume the admin wanted his backup to work completely. If you don't
! * wish to wait, you can set statement_timeout. Also, some notices
! * are issued to clue in anyone who might be doing this interactively.
*/
XLByteToPrevSeg(stoppoint, _logId, _logSeg);
XLogFileName(lastxlogfilename, ThisTimeLineID, _logId, _logSeg);
***************
*** 8141,8146 ****
--- 8142,8150 ----
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;

***************
*** 8155,8162 ****
{
seconds_before_warning *= 2; /* This wraps in >10 years... */
ereport(WARNING,
! (errmsg("pg_stop_backup still waiting for archive to complete (%d seconds elapsed)",
! waits)));
}
}

--- 8159,8169 ----
{
seconds_before_warning *= 2; /* This wraps in >10 years... */
ereport(WARNING,
! (errmsg("pg_stop_backup still waiting for all required WAL segments to be archived (%d seconds elapsed)",
! waits),
! errhint("Check that your archive_command is executing properly. "
! "pg_stop_backup can be cancelled safely, "
! "but the database backup will not be usable without all the WAL segments.")));
}
}

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-02-25 02:33:02 Re: Assertion failure in walreceiver
Previous Message Josh Berkus 2010-02-25 02:15:32 Re: pg_stop_backup does not complete