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 m2ljakw2qk.fsf@hi-media.com
Whole thread Raw
In response to Re: Command to prune archive at restartpoints  (Dimitri Fontaine <dfontaine@hi-media.com>)
Responses Re: Command to prune archive at restartpoints  (Dimitri Fontaine <dfontaine@hi-media.com>)
List pgsql-hackers
Dimitri Fontaine <dfontaine@hi-media.com> writes:
> 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 I'm looking at what it'd take to have that code, and it seems it
would be quite easy. I wonder if we want to return only a boolean
(command success status) or the list of files we're pruning (that's the
SRF part), but other than that, it's all about having the code provided
by Simon in another place and some internal command support.

Something strange though: I notice that the error and signal handling in
pgarch.c::pgarch_archiveXlog (lines 551 and following) and in
xlog.c::ExecuteRecoveryCommand (lines 3143 and following) are very
different for no reason that I can see.

Why is that?

Also, should I try to send a patch implementing my proposal (internal
command exposed as a function at the SQL level, and while at it, maybe
the internal command "pg_archive_bypass" to mimic /usr/bin/true as an
archive_command)?

Regards,
-- 
dim


pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: hstore ==> and deprecate =>
Next
From: Dimitri Fontaine
Date:
Subject: Re: Command to prune archive at restartpoints