Re: Writing WAL for relcache invalidation:pg_internal.init

From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Writing WAL for relcache invalidation:pg_internal.init
Date: 2006-11-02 08:45:39
Message-ID: 1162457139.3587.236.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, 2006-11-01 at 12:05 -0500, Tom Lane wrote:
> "Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
> > Enclose a patch for new WAL records for relcache invalidation.
>
> I don't think this works. RelationCacheInitFileInvalidate is executed
> post-commit, which means that there's a window between commit and where
> you propose to write the WAL entry. A crash and restart in that
> interval would leave the catalog changes committed, but not reflected
> into pg_internal.init.

Surely you are pointing out a bug, no?

If a backend did crash, the init file would be wrong and we'd get
exactly the same wrong relfilenode errors we got after that PITR.

The issue must surely be that the patch isn't wrong per se, just that
RelationCacheInitFileInvalidate is called too late and that requires an
additional fix. Are we certain that a crash between commit and
invalidation will cause a PANIC that takes down the server? Doesn't look
like its in a critical section to me.

> I think we're probably better off to just forcibly remove the init file
> during post-recovery cleanup. The easiest place to do this might be
> BuildFlatFiles, which has to scan pg_database anyway ...

I can do this - I don't have a problem there, but the above issue just
occurred to me so I wonder now if its the right thing to do.

PITR will be always-safe but normal operation might not be.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2006-11-02 09:18:35 Re: Design Considerations for New Authentication Methods
Previous Message Tom Lane 2006-11-02 06:19:28 Re: Re: ¿¿¿past chunk end???

Browse pgsql-patches by date

  From Date Subject
Next Message Jerry Sievers 2006-11-02 14:36:10 Re: [PATCHES] Writing WAL for relcache invalidation:pg_internal.init
Previous Message Simon Riggs 2006-11-01 18:15:42 Re: Writing WAL for relcache invalidation:pg_internal.init