pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: Peter Geoghegan <pg@heroku.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Cc: Kevin Grittner <kgrittn@gmail.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Subject: Re: On conflict update & hint bits
Date: Mon, 24 Oct 2016 10:12:59 +0300
Message-ID: <580DB47B.5000200@postgrespro.ru> (raw)
In-Reply-To: <CAM3SWZS=aJcNe=mQsag-xwHa-gruXzmcCeQucwFD14A8JgUhOw@mail.gmail.com>
References: <57EE93C8.8080504@postgrespro.ru>
	<CAM3SWZQXH4m-CQKsLeP-JeFuezMECJPTJc78EzHY0Z+kwevtLw@mail.gmail.com>
	<CAM3SWZR6AN++h24e6y2NWETjMTCjXDbFgEifOss2jpfPEmqCdw@mail.gmail.com>
	<31342.1477154327@sss.pgh.pa.us>
	<CAM3SWZTj9BHu91uS8J6D8VCL2v19ZOK1JWO-ghuLuWQTTv0hNw@mail.gmail.com>
	<23481.1477255321@sss.pgh.pa.us>
	<CAM3SWZQbij-WS6V46QXJp43XyNrJhGQ7+VDMLX7r0m1BnH82dA@mail.gmail.com>
	<30037.1477259205@sss.pgh.pa.us>
	<CAM3SWZS=aJcNe=mQsag-xwHa-gruXzmcCeQucwFD14A8JgUhOw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>



On 24.10.2016 00:49, Peter Geoghegan wrote:
> On Sun, Oct 23, 2016 at 2:46 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> What's bothering me is (a) it's less than 24 hours to release wrap and
>> (b) this patch changes SSI-relevant behavior and hasn't been approved
>> by Kevin.  I'm not familiar enough with that logic to commit a change
>> in it on my own authority, especially with so little time for problems
>> to be uncovered.
> I should point out that I knew that the next set of point releases had
> been moved forward much later than you did. I had to work on this fix
> during the week, which was pretty far from ideal for me for my own
> reasons.
>
Just for information: I know that you are working on this issue, but as 
far as we need to proceed further with our testing of multimaster,
I have done the following obvious changes and it fixes the problem (at 
least this assertion failure is not happen any more):

src/backend/executor/nodeModifyTable.c

@@ -1087,6 +1087,13 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
      test = heap_lock_tuple(relation, &tuple, estate->es_output_cid,
                             lockmode, LockWaitBlock, false, &buffer,
                             &hufd);
+    /*
+     * We must hold share lock on the buffer content while examining tuple
+     * visibility.  Afterwards, however, the tuples we have found to be
+     * visible are guaranteed good as long as we hold the buffer pin.
+     */
+    LockBuffer(buffer, BUFFER_LOCK_SHARE);
+
      switch (test)
      {
          case HeapTupleMayBeUpdated:
@@ -1142,6 +1149,7 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
               * loop here, as the new version of the row might not conflict
               * anymore, or the conflicting tuple has actually been 
deleted.
               */
+            LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
              ReleaseBuffer(buffer);
              return false;

@@ -1175,6 +1183,8 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
      /* Store target's existing tuple in the state's dedicated slot */
      ExecStoreTuple(&tuple, mtstate->mt_existing, buffer, false);

+    LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+
      /*
       * Make tuple and any needed join variables available to ExecQual and
       * ExecProject.  The EXCLUDED tuple is installed in 
ecxt_innertuple, while

-- 
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (15+ messages)  latest in thread

Message-ID: <580DB47B.5000200@postgrespro.ru>
Permalink:  ../580DB47B.5000200@postgrespro.ru/
Also on:    postgresql.org/message-id/580DB47B.5000200@postgrespro.ru

 · 

reply

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-hackers@postgresql.org
  Cc: k.knizhnik@postgrespro.ru, pg@heroku.com, tgl@sss.pgh.pa.us, andres@anarazel.de, kgrittn@gmail.com, thomas.munro@enterprisedb.com
  Subject: Re: On conflict update & hint bits
  In-Reply-To: <580DB47B.5000200@postgrespro.ru>
  References: <57EE93C8.8080504@postgrespro.ru> <CAM3SWZQXH4m-CQKsLeP-JeFuezMECJPTJc78EzHY0Z+kwevtLw@mail.gmail.com> <CAM3SWZR6AN++h24e6y2NWETjMTCjXDbFgEifOss2jpfPEmqCdw@mail.gmail.com> <31342.1477154327@sss.pgh.pa.us> <CAM3SWZTj9BHu91uS8J6D8VCL2v19ZOK1JWO-ghuLuWQTTv0hNw@mail.gmail.com> <23481.1477255321@sss.pgh.pa.us> <CAM3SWZQbij-WS6V46QXJp43XyNrJhGQ7+VDMLX7r0m1BnH82dA@mail.gmail.com> <30037.1477259205@sss.pgh.pa.us> <CAM3SWZS=aJcNe=mQsag-xwHa-gruXzmcCeQucwFD14A8JgUhOw@mail.gmail.com> <580DB47B.5000200@postgrespro.ru>

* 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