Alvaro Herrera wrote: > Robert Haas wrote: > > On Fri, Jun 17, 2016 at 9:33 AM, Andrew Gierth > > <and...@tao11.riddles.org.uk> wrote: > > >>>>>> "Robert" == Robert Haas <robertmh...@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
commit 17507b2a04b8c381997410d1fe3fbaacc34f5a31[m Author: Alvaro Herrera <alvhe...@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.c index 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.c index 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))
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers