Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Nasby, Jim" <nasbyj(at)amazon(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, Peter Geoghegan <pg(at)bowt(dot)ie>, Jeremy Finzel <finzelj(at)gmail(dot)com>
Subject: Re: found xmin from before relfrozenxid on pg_catalog.pg_authid
Date: 2018-06-12 00:39:14
Message-ID: 20180612003914.qlnrpovmbhorexik@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi,

On 2018-05-28 12:52:06 -0700, Andres Freund wrote:
> Hi,
>
> On 2018-05-27 13:00:06 -0700, Andres Freund wrote:
> > I've a patch that seems to work, that mostly needs some comment
> > polishing.
>
> Attached is what I currently have. Still needs some more work, but I
> think it's more than good enough to review the approach. Basically the
> approach consists out of two changes:
>
> 1) Send init file removals for shared nailed relations as well.
>
> This fixes that the shared init file contains arbitrarily outdated
> information for relfrozenxid etc. Leading to e.g. the pg_authid
> errors we've seen in some recent threads. Only applies to
> new connections.
>
> 2) Reread RelationData->rd_rel for nailed relations when invalidated.
>
> This ensures that already built relcache entries for nailed relations
> are updated. Currently they never are. This currently doesn't cause
> *that* frequently an issue for !shared entries, because for those the
> init file gets zapped regularly, and autovacuum workers usually don't
> live that long. But it's still a significant correctness issue for
> both shared an non shared relations.

Here's a more polished v2 version of the patch. I, locally, did the
work to backpatch the change. Besides trivialities there's two
nontrivial changes:

- In earlier versions there's no global invalidations. I've inquired and
complained about what exactly they're for in
http://archives.postgresql.org/message-id/20180611231634.w2rgtlzxaw4loefk%40alap3.anarazel.de

In earlier branches we just don't do the global thing. That seems
unproblematic to me.

- The bigger issue is that in 9.3, and just there
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=8de3e410faa06ab20ec1aa6d0abb0a2c040261ba
does not yet exist.

That means back then we performed reloads even outside a
transaction. I don't feel confident about invoking additional catalog
reloads in the new situations, so I kept the IsTransactionState()
checks in RelationReloadNailed(). That seems less risky, but possibly
somebody wants to argue the other way round?

There's some minor other conflicts, but they're all pretty obvious.

I plan to go over the change again tomorrow, and then push. Unless
somebody has comments before then, obviously.

> FWIW, I wonder if this isn't critical enough to make us consider having
> a point release earlier..

Still think this is something we should seriously consider.

- Andres

Attachment Content-Type Size
v2-0001-Fix-bugs-in-vacuum-of-shared-rels-by-keeping-thei.patch text/x-diff 15.6 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Haug Bürger 2018-06-12 07:26:43 Bad performance with cascaded deletes
Previous Message Andres Freund 2018-06-12 00:33:05 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

Browse pgsql-hackers by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2018-06-12 01:09:30 RE: [bug fix] ECPG: freeing memory for pgtypes crashes on Windows
Previous Message Andres Freund 2018-06-12 00:33:05 Re: found xmin from before relfrozenxid on pg_catalog.pg_authid