From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Robert Haas <robertmhaas@gmail.com>
Cc: drkp@csail.mit.edu
Cc: yamt@mwd.biglobe.ne.jp
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #5952: SetRWConflict assertion failure
Date: Tue, 05 Apr 2011 11:07:28 -0500
Message-ID: <4D9AF7F0020000250003C317@gw.wicourts.gov> (raw)
In-Reply-To: <BANLkTim0oG9XeHCFGF7FUNh5wBj7aXSbZg@mail.gmail.com>
References: <4D8F4745020000250003BCFA@gw.wicourts.gov>
<BANLkTikA4fwzp5kxRS+69o0=GfO=x+sE5Q@mail.gmail.com>
<4D9AEC7F020000250003C307@gw.wicourts.gov>
<BANLkTim0oG9XeHCFGF7FUNh5wBj7aXSbZg@mail.gmail.com>
Robert Haas <robertmhaas@gmail.com> wrote:
> If you could send a revised patch, that would be great.
Attached. I put it in the same spot relative to the lock
acquisition that was used earlier in the function.
-Kevin
Attachments:ssi-recheck-conflict-in-before-flagging-2.patch (text/plain, 1.9K) download
*** a/src/backend/storage/lmgr/predicate.c
--- b/src/backend/storage/lmgr/predicate.c
***************
*** 3757,3762 **** CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag)
--- 3757,3774 ----
LWLockRelease(partitionLock);
LWLockRelease(SerializablePredicateLockListLock);
LWLockAcquire(partitionLock, LW_SHARED);
+ + /*+ * The list may have been altered by another process+ * while we weren't holding the partition lock. Start+ * over at the front.+ */+ LWLockAcquire(partitionLock, LW_SHARED);+ nextpredlock = (PREDICATELOCK *)+ SHMQueueNext(&(target->predicateLocks),+ &(target->predicateLocks),+ offsetof(PREDICATELOCK, targetLink));+
LWLockAcquire(SerializableXactHashLock, LW_SHARED);
}
}
***************
*** 3770,3776 **** CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag)
LWLockRelease(SerializableXactHashLock);
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
! FlagRWConflict(sxact, (SERIALIZABLEXACT *) MySerializableXact);
LWLockRelease(SerializableXactHashLock);
LWLockAcquire(SerializableXactHashLock, LW_SHARED);
--- 3782,3800 ----
LWLockRelease(SerializableXactHashLock);
LWLockAcquire(SerializableXactHashLock, LW_EXCLUSIVE);
! /*
! * Re-check after getting exclusive lock because the other
! * transaction may have flagged a conflict.
! */
! if (!SxactIsRolledBack(sxact)
! && (!SxactIsCommitted(sxact)
! || TransactionIdPrecedes(GetTransactionSnapshot()->xmin,
! sxact->finishedBefore))
! && !RWConflictExists(sxact,
! (SERIALIZABLEXACT *) MySerializableXact))
! {
! FlagRWConflict(sxact, (SERIALIZABLEXACT *) MySerializableXact);
! }
LWLockRelease(SerializableXactHashLock);
LWLockAcquire(SerializableXactHashLock, LW_SHARED);
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Kevin.Grittner@wicourts.gov, robertmhaas@gmail.com, drkp@csail.mit.edu, yamt@mwd.biglobe.ne.jp
Subject: Re: BUG #5952: SetRWConflict assertion failure
In-Reply-To: <4D9AF7F0020000250003C317@gw.wicourts.gov>
References: <4D8F4745020000250003BCFA@gw.wicourts.gov> <BANLkTikA4fwzp5kxRS+69o0=GfO=x+sE5Q@mail.gmail.com> <4D9AEC7F020000250003C307@gw.wicourts.gov> <BANLkTim0oG9XeHCFGF7FUNh5wBj7aXSbZg@mail.gmail.com> <4D9AF7F0020000250003C317@gw.wicourts.gov>
* 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