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