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

Failed CLUSTER seems to leave files behind

From: Antti Salmela <asalmela(at)iki(dot)fi>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Failed CLUSTER seems to leave files behind
Date: 2005-11-03 07:22:47
Message-ID: 20051103072247.GA15984@asalmela.iki.fi (view raw or flat)
Thread:
Lists: 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(at)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

Responses

pgsql-bugs by date

Next:From: IvanDate: 2005-11-03 09:00:57
Subject: pg_dumpall bug & feature request
Previous:From: Bernhard WeisshuhnDate: 2005-11-03 05:56:27
Subject: BUG #2018: segfaults with some german errormessages

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