Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxzLM-0001Kp-9j for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Oct 2016 16:40:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bxzLK-0002vq-GT for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Oct 2016 16:40:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bxzJx-0001LM-H4 for pgsql-hackers@postgresql.org; Sat, 22 Oct 2016 16:38:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bxzJu-0002kT-EJ for pgsql-hackers@postgresql.org; Sat, 22 Oct 2016 16:38:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9MGclog031343; Sat, 22 Oct 2016 12:38:47 -0400 From: Tom Lane To: Peter Geoghegan cc: Konstantin Knizhnik , PostgreSQL Hackers , Andres Freund , Kevin Grittner , Thomas Munro Subject: Re: On conflict update & hint bits In-reply-to: References: <57EE93C8.8080504@postgrespro.ru> Comments: In-reply-to Peter Geoghegan message dated "Wed, 19 Oct 2016 17:33:34 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31341.1477154327.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 22 Oct 2016 12:38:47 -0400 Message-ID: <31342.1477154327@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Peter Geoghegan writes: > Attached is a revision of Thomas' patch to fix a related issue; it now > also fixes this no-buffer-lock-held issue. I think this needs more work. 1. Why are you replacing ExecOnConflictUpdate's ExecCheckHeapTupleVisible call with ExecCheckTIDVisible? That appears to demand a re-fetch of the tuple ExecOnConflictUpdate already has its hands on. Wouldn't it be better to just put a buffer lock/unlock around the existing code? 2. Your proposed coding + if (!heap_fetch(rel, estate->es_snapshot, &tuple, &buffer, true, NULL)) + ... + if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple.t_= data))) will dump core in the case where heap_fetch returns false with tuple.t_data set to null. If that case is impossible here, it's not apparent why, and it'd surely deserve at least a comment, maybe an Assert. But I'd rather just assume it's possible. I'm not taking a position on whether this is OK at the higher level of whether the SSI behavior could be better. However, unless Kevin has objections to committing something like this now, I think we should fix the above-mentioned problems and push it. The existing behavior is clearly bad. regards, tom lane --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers