Failed CLUSTER seems to leave files behind - Mailing list pgsql-bugs

From Antti Salmela
Subject Failed CLUSTER seems to leave files behind
Date
Msg-id 20051103072247.GA15984@asalmela.iki.fi
Whole thread Raw
Responses Re: Failed CLUSTER seems to leave files behind  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Failed CLUSTER due to insufficient disk space seems to leave temporary files
behind at least on 7.4.7.

I used the following perl script to determine if there is files which do not
have corresponding entry in pg_class and timestamps of these files matched
with failed CLUSTER attempts.

Is it safe to remove these files manually?

#!/usr/bin/perl

use DBI;

my $dbh = DBI->connect("dbi:Pg:dbname=foo", "postgres", "") or die;

my $sth = $dbh->prepare("SELECT relname FROM pg_class WHERE relfilenode = ?") or die;

foreach(<*>) {
    if(/^\d+$/) {
    $sth->execute($_);
    my ($result) = $sth->fetchrow_array;
    if (! $result) {
        print "$_\n";
        foreach(<$_.*>) {
        print "$_\n";
        }
    }
    }
}

postgres@helium:~/data/base/1045047$ ~as/bin/pg_base.pl | xargs ls -l
-rw-------  1 postgres postgres 1073741824 Sep 18 04:09 32857427
-rw-------  1 postgres postgres 1073741824 Sep 18 04:14 32857427.1
-rw-------  1 postgres postgres 1073741824 Sep 18 04:19 32857427.2
-rw-------  1 postgres postgres  747692032 Sep 18 04:22 32857427.3
-rw-------  1 postgres postgres          0 Sep 18 04:04 32857429
-rw-------  1 postgres postgres       8192 Sep 18 04:04 32857431
-rw-------  1 postgres postgres  529743872 Sep 18 04:28 32857432
-rw-------  1 postgres postgres  529743872 Sep 18 04:39 32857433
-rw-------  1 postgres postgres 1073741824 Sep 18 05:00 32857434
-rw-------  1 postgres postgres 1073741824 Sep 18 05:01 32857434.1
-rw-------  1 postgres postgres  784752640 Sep 18 05:02 32857434.2
-rw-------  1 postgres postgres 1073741824 Oct 23 04:13 32870084
-rw-------  1 postgres postgres 1073741824 Oct 23 04:19 32870084.1
-rw-------  1 postgres postgres 1073741824 Oct 23 04:25 32870084.2
-rw-------  1 postgres postgres 1073741824 Oct 23 04:31 32870084.3
-rw-------  1 postgres postgres   99000320 Oct 23 04:32 32870084.4
-rw-------  1 postgres postgres          0 Oct 23 04:05 32870086
-rw-------  1 postgres postgres       8192 Oct 23 04:05 32870088
-rw-------  1 postgres postgres  584728576 Oct 23 04:38 32870089
-rw-------  1 postgres postgres  584728576 Oct 23 04:51 32870090
-rw-------  1 postgres postgres 1073741824 Oct 23 05:12 32870091
-rw-------  1 postgres postgres 1073741824 Oct 23 05:14 32870091.1
-rw-------  1 postgres postgres  831553536 Oct 23 05:15 32870091.2

--
Antti Salmela

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2014: createdb and other client binaries core dumps
Next
From: Ivan
Date:
Subject: pg_dumpall bug & feature request