found xmin from before relfrozenxid on pg_catalog.pg_authid

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
45 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

jfinzel


BTW is it just a coincidence or are all the affected tables pg_authid?
Maybe the problem is shared relations ..?  Maybe the fact that they have
separate relfrozenxid (!?) in different databases?

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
 We have had this problem twice and both times on both pg_authid and pg_auth_members. Thanks,

Jeremy 
Reply | Threaded
Open this post in threaded view
|

Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

Alvaro Herrera-9
In reply to this post by Andres Freund
On 2018-May-24, Andres Freund wrote:

> On 2018-05-24 16:49:40 -0400, Alvaro Herrera wrote:
> > BTW is it just a coincidence or are all the affected tables pg_authid?
> > Maybe the problem is shared relations ..?  Maybe the fact that they have
> > separate relfrozenxid (!?) in different databases?
>
> Yes, that appears to be part of the problem. I've looked at a number of
> shared relation related codepaths, but so far my theory is that the
> relcache is wrong. Note that one of the reports in this thread clearly
> had a different relcache relfrozenxid than in the catalog.

Hmm ... is that because they read the values on different databases?
Are you referring to the reports by Maxim Boguk?  I see one value from
template1, another value from template0.

> Then there's also:
> http://archives.postgresql.org/message-id/1527193504642.36340%40amazon.com

ah, so deleting the relcache file makes the problem to go away?  That's
definitely pretty strange.  I see no reason for the value in relcache to
become out of step with the catalogued value in the same database ... I
don't think we transmit in any way values of one database to another.

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Reply | Threaded
Open this post in threaded view
|

Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

Andres Freund
On 2018-05-24 17:13:11 -0400, Alvaro Herrera wrote:

> On 2018-May-24, Andres Freund wrote:
>
> > On 2018-05-24 16:49:40 -0400, Alvaro Herrera wrote:
> > > BTW is it just a coincidence or are all the affected tables pg_authid?
> > > Maybe the problem is shared relations ..?  Maybe the fact that they have
> > > separate relfrozenxid (!?) in different databases?
> >
> > Yes, that appears to be part of the problem. I've looked at a number of
> > shared relation related codepaths, but so far my theory is that the
> > relcache is wrong. Note that one of the reports in this thread clearly
> > had a different relcache relfrozenxid than in the catalog.
>
> Hmm ... is that because they read the values on different databases?
> Are you referring to the reports by Maxim Boguk?  I see one value from
> template1, another value from template0.

I was referring to
https://www.postgresql.org/message-id/20180522193007.4bi5oluqb7c72oq2@...
but you're right, it's possible that that's just caused by time passing
or different databases.

Greetings,

Andres Freund

Reply | Threaded
Open this post in threaded view
|

Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

Andres Freund
In reply to this post by Alvaro Herrera-9
On 2018-05-24 16:46:24 -0400, Alvaro Herrera wrote:

> On 2018-May-24, Andres Freund wrote:
>
> > On 2018-05-24 13:08:53 -0400, Alvaro Herrera wrote:
> > > Hmm .. surely
>
> > >   xid = HeapTupleHeaderGetXmin(tuple);
> > >   xmin_frozen = ((xid == FrozenTransactionId) ||
> > >     HeapTupleHeaderXminFrozen(tuple));
> > > - if (TransactionIdIsNormal(xid))
> > > + if (!xmin_frozen && TransactionIdIsNormal(xid))
>
> > I don't think that's necesary - HeapTupleHeaderGetXmin() returns
> > FrozenTransactionId if the tuple is frozen (note the
> > HeapTupleHeaderXminFrozen() within).
>
> Ah, yeah ... I probably thought about this when writing it and removed
> it for that reason.
>
> BTW I think the definition of HeapTupleHeaderXminFrozen is seriously
> confusing, by failing to return true if the xmin is numerically
> FrozenXid (which it'll be if the database was pg_upgraded).  I wonder
> about this one in HeapTupleSatisfiesMVCC:

I suggest raising this on -hackers. I agree that it's unfortunate.

Greetings,

Andres Freund

Reply | Threaded
Open this post in threaded view
|

Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

Peter Geoghegan-4
On Fri, May 25, 2018 at 1:38 PM, Andres Freund <[hidden email]> wrote:
>> BTW I think the definition of HeapTupleHeaderXminFrozen is seriously
>> confusing, by failing to return true if the xmin is numerically
>> FrozenXid (which it'll be if the database was pg_upgraded).  I wonder
>> about this one in HeapTupleSatisfiesMVCC:
>
> I suggest raising this on -hackers. I agree that it's unfortunate.

I wonder if BootstrapTransactionId also needs to be considered here.

--
Peter Geoghegan

123