Re: Can Postgres 8.x start if some disks containing tablespaces are not mounted?

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Morris Goldstein" <morris(dot)x(dot)goldstein(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, "PGSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Can Postgres 8.x start if some disks containing tablespaces are not mounted?
Date: 2008-03-31 19:15:13
Message-ID: 65937bea0803311215s2ced44b6se29e55282f98662c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Mar 31, 2008 at 11:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "Morris Goldstein" <morris(dot)x(dot)goldstein(at)gmail(dot)com> writes:
> > Suppose I have a database with $PGDATA on /dev/sda, and a tablespace
> > directory on /dev/sdb. Will Postgres start successfully if /dev/sda is
> > mounted and /dev/sdb is not? If not, why not?
>
> It will start, but you will have unpleasant failures when you try to use
> tables in the secondary tablespace ... note that if autovacuum is on,
> that is likely to happen even without any explicit action on your part.
>
>
One of the gripes I have with postgres is that, that it won't even complain
if one of the segments of a relation goes missing unless the missing segment
is referred to by an index!!!

The most troublesome part is that count(*) (i.e seq scan) scans only upto
the last sequential segment found. Here's a case in example:

Healthy:
--------
count(*) : 2187001
size: 2441 MB
segments: 17651, .1, .2

Corrupt: 17651.1 missing
-------------------------
count(*) : 917503
size: 1024 MB
segments: 17651, .2
select max(a) from temp: 2187001 (uses index to locate the last tuple in
segment .2)

select a from temp where a = (select max(a) from temp)/2
ERROR: could not read block 156214 of relation 1663/11511/17651: read only
0 of 8192 bytes

retore missing segment:
-----------------------
select a from temp where a = (select max(a) from temp)/2
: 1093500

I think that the counter-argument would be that this has never been
reported in the field, but I wish our metadata records this somehow, and
reports an ERROR if it finds that a segment is missing.

Best regards,
--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB http://www.enterprisedb.com

Mail sent from my BlackLaptop device

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mark 2008-03-31 19:16:14 simple update queries take a long time - postgres 8.3.1
Previous Message Just Someone 2008-03-31 19:02:07 Re: Very slow catalog query

Browse pgsql-hackers by date

  From Date Subject
Next Message James Mansion 2008-03-31 19:26:01 Re: first time hacker ;) messing with prepared statements
Previous Message James Mansion 2008-03-31 19:14:47 pgkill