Re: pg_internal.init is hazardous to your health

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Gavin Sherry" <swm(at)linuxworld(dot)com(dot)au>, "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_internal.init is hazardous to your health
Date: 2006-10-18 17:01:50
Message-ID: 1161190910.8652.83.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2006-10-18 at 12:49 +1000, Gavin Sherry wrote:

> > We don't actually need to *update* the file, per se, we only need to
> > remove it if no longer valid --- the next incoming backend will rebuild
> > it. I could see fixing this by making WAL recovery run around and zap
> > all the .init files (only problem is to find 'em), or we could add a new
> > kind of WAL record saying "remove the .init file for database XYZ"
> > to be emitted whenever someone removes the active one. Thoughts?

Yes, that assessment seems good.

> The latter seems the Right Way except, I guess, that the decision to
> remove the file is buried deep inside inval.c.

I'd prefer the zap everything approach, but emitting a WAL record looks
mostly straightforward and just as good.

RelationCacheInitFileInvalidate() can easily emit a WAL record. This is
called twice in succession, so we would emit WAL on the
RelationCacheInitFileInvalidate(true) call only. I'll work out a patch
for that...XLOG_XACT_RELCACHE_INVALIDATE

RelationCacheInitFileInvalidate() is also called on each
FinishPreparedTransaction(). If that is called 100% of the time, then we
can skip writing an additional record for prepared transactions by
triggering the removal of pg_internal.init when we see a
XLOG_XACT_COMMIT_PREPARED during replay.
Not sure whether we need to do that, Heikki? Anyone?
I'm guessing no, but it seems sensible to check.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-10-18 17:05:55 Re: 8.1.5 is out
Previous Message Robert Treat 2006-10-18 16:59:20 Re: Hints proposal