Re: erroneous restore into pg_catalog schema
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Heikki Linnakangas <hlinnakangas@vmware.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Erik Rijkers <er@xs4all.nl>, Dimitri Fontaine <dimitri@2ndquadrant.fr>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Kohei KaiGai <kaigai@kaigai.gr.jp>
Date: 2013-05-13T19:16:17Z
Lists: pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-05-13 14:48:52 -0400, Tom Lane wrote:
>> Andres Freund <andres@2ndquadrant.com> writes:
>>> DROPing and recreating a new index in --single mode isn't that
>>> uncommon...
>> Surely you'd just REINDEX it instead. Moreover, if it isn't a system
>> index already, why are you doing this in --single mode at all?
> The last case I had was that an index was corrupted in a way that
> autovacuum got stuck on the corrupt index and wasn't killable. Without
> single mode it was hard to be fast enough to drop the index before
> autovac grabbed the lock again.
Meh. Actually, after looking closer at xlog.c, the OID counter starts
out at FirstBootstrapObjectId, which is not what I'd been thinking.
So a value less than that must indicate wraparound, which presumably
never happens during initdb. We could just change the code to
if (ShmemVariableCache->nextOid < ((Oid) FirstBootstrapObjectId))
{
/* wraparound while in standalone environment */
ShmemVariableCache->nextOid = FirstNormalObjectId;
ShmemVariableCache->oidCount = 0;
}
which is a bit asymmetric-looking but should do the right thing in all
cases.
regards, tom lane
Commits
-
Extend and improve use of EXTRA_REGRESS_OPTS.
- 4ae5ee6c9b4d 9.3.0 cited
-
Remove misplaced sanity check from heap_create().
- a475c6036752 9.3.0 cited
-
Silently ignore any nonexistent schemas that are listed in search_path.
- 880bfc3287dd 9.2.0 cited