Re: Command to prune archive at restartpoints - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Command to prune archive at restartpoints
Date
Msg-id m2hbl9sa9a.fsf@hi-media.com
Whole thread Raw
In response to Re: Command to prune archive at restartpoints  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Command to prune archive at restartpoints
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> So to clean up all WAL files older than those needed by that base backup,
> you would simply copy-paste that location and call pg_cleanuparchive:
>
> pg_cleanuparchive /walarchive/ 00000001000000000000002F

Ok, idle though: what about having a superuser-only SRF doing the same?
So that we have internal command for simple case, and SRF for use in
scripts in more complex case.

> Of course, if there's a perl one-liner to do that, we can just put that in
> the docs and don't really need pg_cleanuparchive at all.

psql -c "SELECT * FROM pg_cleanup_archive('00000001000000000000002F');"

>> Therefore my take on this problem is to provide internal commands here,
>> that maybe wouldn't need to be explicitly passed any argument. If
>> they're internal they certainly can access to the information they need?
>
> You want more flexibility in more advanced cases. Like if you have multiple
> standbys sharing the archive, you only want to remove old WAL files after
> they're not needed by *any* of the standbys anymore. Doing the cleanup
> directly in the archive_cleanup_command would cause the old WAL files to be
> removed prematurely, but you could put a shell script there to store the
> location to a file, and call pg_cleanuparchive with the max() of the
> locations reported by all standby servers.

Yes you still need to support external commands. That was not at all
what I'm proposing: I'm just after having the simple case dead simple to
setup. Like you don't write any script.

Regards,
-- 
dim


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Error with GIT Repository
Next
From: Joseph Adams
Date:
Subject: Re: hstore ==> and deprecate =>