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

Re: Command to prune archive at restartpoints

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Greg Stark <gsstark(at)mit(dot)edu>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Command to prune archive at restartpoints
Date: 2010-06-08 23:07:10
Message-ID: 4C0ECD1E.1050709@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> As for the language choice, my first thought is +1 for perl over shell,
> mainly because it might be directly useful to people on Windows while
> shell never would be.  On the other hand, if it's possible to do a
> useful one-liner in shell then let's do it that way.
>   

I don't think it is, reasonably. But here is fairly minimal version that 
might suit the docs:

    use strict;
    my ($dir, $num) = @ARGV;
    foreach my $file (glob("$dir/*"))
    {
            my $name = basename($file);
            unlink $file if (-f $file && $name =~ /^[0-9A-Z]{24}$/ && $name lt $num);
    }
      



cheers

andrew

In response to

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-06-09 00:34:02
Subject: Re: Idea for getting rid of VACUUM FREEZE on cold pages
Previous:From: Alvaro HerreraDate: 2010-06-08 23:07:05
Subject: Re: Idea for getting rid of VACUUM FREEZE on cold pages

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