Skip site navigation (1) Skip section navigation (2)

Re: Command to prune archive at restartpoints

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Command to prune archive at restartpoints
Date: 2010-06-10 15:33:25
Message-ID: 4C1105C5.20907@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackers

Heikki Linnakangas wrote:
> On 10/06/10 17:38, Andrew Dunstan wrote:
>> I think my logic needs a tiny piece of adjustment, to ignore the
>> timeline segment of the file name.
>
> I'm not sure you should ignore it. Presumably anything in an older 
> timeline is indeed not required anymore and can be removed, and 
> anything in a newer timeline... how did it get there? Seems safer not 
> remove it.
>

Well, I was just following the logic in pg-standby.c:

                /*
                 * We ignore the timeline part of the XLOG segment 
identifiers
                 * in deciding whether a segment is still needed.  This
                 * ensures that we won't prematurely remove a segment from a
                 * parent timeline. We could probably be a little more
                 * proactive about removing segments of non-parent 
timelines,
                 * but that would be a whole lot more complicated.
                 *
                 * We use the alphanumeric sorting property of the filenames
                 * to decide which ones are earlier than the
                 * exclusiveCleanupFileName file. Note that this means files
                 * are not removed in the order they were originally 
written,
                 * in case this worries you.
                 */
                if (strlen(xlde->d_name) == XLOG_DATA_FNAME_LEN &&
                    strspn(xlde->d_name, "0123456789ABCDEF")
                        == XLOG_DATA_FNAME_LEN &&
                  strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) 
< 0)


cheers

andrew


In response to

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2010-06-10 15:37:49
Subject: Re: fix use of posix_fadvise in xlog.c
Previous:From: Andrew DunstanDate: 2010-06-10 15:26:59
Subject: Re: Error with GIT Repository

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group