From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-hackers@postgresql.org
Subject: Re: MultiXactId error after upgrade to 9.3.4
Date: Mon, 31 Mar 2014 10:02:15 -0300
Message-ID: <20140331130215.GV9567@eldon.alvh.no-ip.org> (raw)
In-Reply-To: <20140331123030.GB18358@alap3.anarazel.de>
References: <20140330040029.GY4582@tamriel.snowman.net>
<20140330141135.GA4582@tamriel.snowman.net>
<20140330185349.GD4582@tamriel.snowman.net>
<20140331115452.GT9567@eldon.alvh.no-ip.org>
<20140331115713.GA18358@alap3.anarazel.de>
<20140331121912.GU9567@eldon.alvh.no-ip.org>
<20140331123030.GB18358@alap3.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Andres Freund wrote:
> On 2014-03-31 09:19:12 -0300, Alvaro Herrera wrote:
> > Andres Freund wrote:
> > > On 2014-03-31 08:54:53 -0300, Alvaro Herrera wrote:
> > > > My conclusion here is that some part of the code is failing to examine
> > > > XMAX_INVALID before looking at the value stored in xmax itself. There
> > > > ought to be a short-circuit. Fortunately, this bug should be pretty
> > > > harmless.
> > > >
> > > > .. and after looking, I'm fairly sure the bug is in
> > > > heap_tuple_needs_freeze.
> > >
> > > heap_tuple_needs_freeze() isn't *allowed* to look at
> > > XMAX_INVALID. Otherwise it could miss freezing something still visible
> > > on a standby or after an eventual crash.
> >
> > Ah, you're right. It even says so on the comment at the top (no
> > caffeine yet.) But what it's doing is still buggy, per this report, so
> > we need to do *something* ...
>
> Are you sure needs_freeze() is the problem here?
>
> IIRC it already does some checks for allow_old? Why is the check for
> that not sufficient?
GetMultiXactIdMembers has this:
if (MultiXactIdPrecedes(multi, oldestMXact))
{
ereport(allow_old ? DEBUG1 : ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("MultiXactId %u does no longer exist -- apparent wraparound",
multi)));
return -1;
}
if (!MultiXactIdPrecedes(multi, nextMXact))
ereport(ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("MultiXactId %u has not been created yet -- apparent wraparound",
multi)));
I guess I wasn't expecting that too-old values would last longer than a
full wraparound cycle. Maybe the right fix is just to have the second
check also conditional on allow_old.
Anyway, it's not clear to me why this database has a multixact value of
6 million when the next multixact value is barely above one million.
Stephen said a wraparound here is not likely.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, andres@2ndquadrant.com, sfrost@snowman.net
Subject: Re: MultiXactId error after upgrade to 9.3.4
In-Reply-To: <20140331130215.GV9567@eldon.alvh.no-ip.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox