Re: single user mode -P option is ignored

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: single user mode -P option is ignored
Date: 2018-12-19 17:18:18
Message-ID: CAFj8pRBYYZBkq9OihkRM=AROu_o1O1TBfFrNCLJDoKBhsDB0mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

st 19. 12. 2018 v 17:59 odesílatel Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> napsal:

> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> > some customer has PostgreSQL 9.5.5. He cannot to login to database due
> > broken index
> > When I use single mode against to this database I got a error
> > start transaction
> > could not open critical system index 2679
>
> I can't reproduce this. Removing file 2679 (pg_index_indexrelid_index)
> from an otherwise-OK database leads to
>
> $ postgres --single busted
> FATAL: could not open file "base/78215/2679": No such file or
> directory
>
> as expected, but
>
> $ postgres --single -P busted
>
> PostgreSQL stand-alone backend 9.5.15
> backend>
>
> and all seems well, in particular I can successfully do
>
> backend> reindex index pg_index_indexrelid_index;
>
> and then things are back to normal.
>
> So either this is something we fixed since 9.5.5, or your summary
> of the problem is missing many critical details.
>

I got different error message "could not open critical system index". I
checked files, and related files was there.

I think so this issue is related to some damage of some system catalog -
maybe pg_class, pg_attribute, ..

I got some diagnostics, but it is running on win, and the connect there is
pretty slow

static void
load_critical_index(Oid indexoid, Oid heapoid)
{
<-->Relation<-->ird;

<-->/*
<--> * We must lock the underlying catalog before locking the index to avoid
<--> * deadlock, since RelationBuildDesc might well need to read the
catalog,
<--> * and if anyone else is exclusive-locking this catalog and index
they'll
<--> * be doing it in that order.
<--> */
<-->LockRelationOid(heapoid, AccessShareLock);
<-->LockRelationOid(indexoid, AccessShareLock);
<-->ird = RelationBuildDesc(indexoid, true);
<-->if (ird == NULL)
<--><-->elog(PANIC, "could not open critical system index %u", indexoid);
<-->ird->rd_isnailed = true;
<-->ird->rd_refcnt = 1;
<-->UnlockRelationOid(indexoid, AccessShareLock);
<-->UnlockRelationOid(heapoid, AccessShareLock);

looks like this code is called every time

Note:

I was not able to compile PostgreSQL 9.5 on Fedora 29 :-/

> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-12-19 18:01:30 Re: single user mode -P option is ignored
Previous Message Tom Lane 2018-12-19 17:11:08 Re: WRITE_*_ARRAY macros for outfuncs.c