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>
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