Re: Fixing OID directory names after a fsck

From: Richard Neill <postgresql(at)richardneill(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Fixing OID directory names after a fsck
Date: 2017-09-11 22:27:08
Message-ID: 35287149-87d0-0763-6566-4aca468d0bad@richardneill.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Tom,

Thanks for your help - and speedy reply.

>> So, I made a clean install of Postgres 9.4 on a new machine (Ubuntu
>> 17.04), and copied the directories into
>> /var/lib/postgresql/9.4/main/base. I now have:
>
>> root(at)treacle:/var/lib/postgresql/9.4/main/base# ls
>> 1 12172 12177 16384 1828647 1835009 1835289 1835317 1835987
>> 1843977 1844229 1844901 1958920
>
>> where the first 3 directories are the system defaults, 16384 is a test
>> that I created, and 1828647 - 1958920 are the recovered top-level
>> database directories (but with the wrong names). However, Postgresql
>> doesn't recognise them.
>
> This is unlikely to work unless you can also recover the pg_clog
> contents, which unfortunately might be pretty difficult to identify.

I can't find it. However, the failure was in the middle of the night,
and I think there's a pretty decent chance that postgres was idle at the
time - there was "probably" no transaction in progress, and the WAL
should have committed. The DBs concerned were all for our wikis, so the
structure will also be comparatively simple (and some risk of
data-errors would be tolerable in this context). There is ~ 400 MB of
data in total, almost all of it in one of the directories.

So, I think it's worth a try - but I'm not sure how to proceed next.

> (In any case, putting the cluster back into production is way too
> scary. If you can start it, with autovacuum off, and dump the data,
> I'd recommend doing that and reloading.)

Definitely! I was going to do that anyway. The point of the new machine
was just to ensure that Postgres itself is known to be in a sane state.
But as soon as I can get anything to work, I'll do a dump and restore.

Thanks very much,

Richard

>
> regards, tom lane
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2017-09-11 22:39:17 Re: Fixing OID directory names after a fsck
Previous Message Tom Lane 2017-09-11 22:09:12 Re: Fixing OID directory names after a fsck