From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Stephen Frost <sfrost@snowman.net>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: MultiXactId error after upgrade to 9.3.4
Date: Tue, 21 Jun 2016 18:15:43 -0400
Message-ID: <20160621221543.GA123505@alvherre.pgsql> (raw)
In-Reply-To: <20160621200922.GA106138@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Alvaro Herrera wrote:
> Robert Haas wrote:
> > On Fri, Jun 17, 2016 at 9:33 AM, Andrew Gierth
> > <andrew@tao11.riddles.org.uk> wrote:
> > >>>>>> "Robert" == Robert Haas <robertmhaas@gmail.com> writes:
> > > >> Why is the correct rule not "check for and ignore pre-upgrade mxids
> > > >> before even trying to fetch members"?
> > >
> > > Robert> I entirely believe that's the correct rule, but doesn't
> > > Robert> implementing it require a crystal balll?
> > >
> > > Why would it? Pre-9.3 mxids are identified by the combination of flag
> > > bits in the infomask, see Alvaro's patch.
> >
> > I see the patch, but I don't see much explanation of why the patch is
> > correct, which I think is pretty scary in view of the number of
> > mistakes we've already made in this area.
>
> ... and actually the patch fails one isolation tests in 9.3, which is
> why I haven't pushed (I haven't tested 9.4 but I suppose it should be
> the same). I'm looking into that now.
Ah, it should have been obvious; the reason it's failing is because 9.3
and 9.4 lack commit 27846f02c176 which removed
MultiXactHasRunningRemoteMembers(), so the straight backpatch plus
conflict fixes left one GetMultiXactIdMembers call with the allow_old
flag to true. The attached patch fixes that omission.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:
[text/x-diff] locked-upgraded-93-fixup.patch (1.6K, ../20160621221543.GA123505@alvherre.pgsql/2-locked-upgraded-93-fixup.patch)
download | inline diff:
commit 17507b2a04b8c381997410d1fe3fbaacc34f5a31[m
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
AuthorDate: Tue Jun 21 18:07:49 2016 -0400
CommitDate: Tue Jun 21 18:07:49 2016 -0400
fixup MultiXactHasRunningRemoteMembers
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.cindex 15de62d..efbca6f 100644--- a/src/backend/access/transam/multixact.c+++ b/src/backend/access/transam/multixact.c@@ -1448,7 +1448,7 @@ MultiXactHasRunningRemoteMembers(MultiXactId multi)
int nmembers;
int i;
- nmembers = GetMultiXactIdMembers(multi, &members, true);+ nmembers = GetMultiXactIdMembers(multi, &members, false);
if (nmembers <= 0)
return false;
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.cindex 9d7050a..931e2fb 100644--- a/src/backend/utils/time/tqual.c+++ b/src/backend/utils/time/tqual.c@@ -701,7 +701,9 @@ HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
if (tuple->t_infomask & HEAP_XMAX_IS_MULTI)
{
- if (MultiXactHasRunningRemoteMembers(xmax))+ if (HEAP_LOCKED_UPGRADED(tuple->t_infomask))+ return HeapTupleMayBeUpdated;+ else if (MultiXactHasRunningRemoteMembers(xmax))
return HeapTupleBeingUpdated;
else
return HeapTupleMayBeUpdated;
@@ -725,6 +727,7 @@ HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid,
/* not LOCKED_ONLY, so it has to have an xmax */
Assert(TransactionIdIsValid(xmax));
+ Assert(!HEAP_LOCKED_UPGRADED(tuple->t_infomask));
/* updating subtransaction must have aborted */
if (!TransactionIdIsCurrentTransactionId(xmax))
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, robertmhaas@gmail.com, andrew@tao11.riddles.org.uk, sfrost@snowman.net
Subject: Re: MultiXactId error after upgrade to 9.3.4
In-Reply-To: <20160621221543.GA123505@alvherre.pgsql>
* 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