Re: pg_stop_backup does not complete

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 01:36:26
Message-ID: 4B85D41A.1070904@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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. Here's what it
looks like when you run into the bad situation (which I easily simulated
with "archive_command='/bin/false'") from the client's perspective:

gsmith(at)meddle:~/pgwork/src/master/src$ psql -c "select
pg_start_backup('test')"
pg_start_backup
-----------------
0/5000020
(1 row)

gsmith(at)meddle:~/pgwork/src/master/src$ psql
psql (9.0devel)
Type "help" for help.

gsmith=# select pg_stop_backup();
NOTICE: pg_stop_backup cleanup done, waiting for required segments to
archive
WARNING: pg_stop_backup still waiting for all required segments to
archive (60 seconds elapsed)
HINT: Confirm your archive_command is executing successfully.
pg_stop_backup can be aborted safely, but the resulting backup will not
be usable.
^CCancel request sent
ERROR: canceling statement due to user request

And this is the sort of thing that shows up in the logs with default
logging behavior while all this is happening; you don't see the NOTICE,
but the WARNING and HINT are both there which I think is good:

LOG: archive command failed with exit code 1
DETAIL: The failed archive command was: /bin/false
WARNING: transaction log file "000000010000000000000000" could not be
archived: too many failures
WARNING: pg_stop_backup still waiting for all required segments to
archive (60 seconds elapsed)
HINT: Confirm your archive_command is executing successfully.
pg_stop_backup can be aborted safely, but the resulting backup will not
be usable.

Does this solve the logging side of this? You can still make a case for
a more forceful pg_stop_backup, this seems to at least remove much of
the mystery and frustration from the whole exercise. This patch plus a
little documentation suggesting how to recover from this issue might be
enough.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

Attachment Content-Type Size
stop-backup-warning.diff text/x-patch 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2010-02-25 01:47:19 Re: pg_stop_backup does not complete
Previous Message Fujii Masao 2010-02-25 01:36:07 Re: testing cvs HEAD - HS/SR - xlog timeline 0 pg_xlogfile_name_offset