Re: [HACKERS] Should *.backup files ever be removed from pg_xlog?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Should *.backup files ever be removed from pg_xlog?
Date: 2005-06-09 01:55:59
Message-ID: 200506090155.j591txc11470@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> Tom Lane wrote:
> > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > > When you do a pg_start_backup()/pg_stop_backup(), the *.backup files
> > > created in pg_xlog are never deleted. Is that intended?
> >
> > Yes. See the documentation. DBAs can delete 'em if they feel like,
> > but I don't see a strong argument for automatically removing 'em.
> > They aren't actually large ...
>
> I don't see anywhere in the documentation where we say you can get rid
> of them. I see this:
>
> For example, if the starting WAL file is 0000000100001234000055CD the
> backup history file will be named something like
> 0000000100001234000055CD.007C9330.backup. (The second number in the file
> name stands for an exact position within the WAL file, and can
> ordinarily be ignored.) Once you have safely archived the file system
> backup and the WAL segment files used during the backup (as specified in
> the backup history file), all archived WAL segments with names
> numerically less are no longer needed to recover the file system backup
> and may be deleted. However, you should consider keeping several backup
> sets to be absolutely certain that you are can recover your data. Keep
> in mind that only completed WAL segment files are archived, so there
> will be delay between running pg_stop_backup and the archiving of all
> WAL segment files needed to make the file system backup consistent.
>
> The "all archived WAL segments with names numerically less are no longer
> needed" I assume is talking about files in the archive location, not
> pg_xlog. Does this need clarifying?

I have fixed the code to properly remove *.backup files from the
/pg_xlog directory once they are archived. The patch is larger because
of an indenting change --- the 'else if' part is the new part.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-06-09 01:57:29 Re: [PATCHES] regexp_replace
Previous Message Neil Conway 2005-06-09 01:29:31 Re: The Contrib Roundup (long)

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-06-09 01:57:29 Re: [PATCHES] regexp_replace
Previous Message Alvaro Herrera 2005-06-09 01:16:48 Re: Are you actively hacking on 2PC?