Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id DF54BB5D94C for ; Tue, 28 Jun 2011 03:45:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 51587-02 for ; Tue, 28 Jun 2011 06:44:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og126.obsmtp.com (exprod7og126.obsmtp.com [64.18.2.206]) by mail.postgresql.org (Postfix) with ESMTP id C90FDB5D90E for ; Tue, 28 Jun 2011 03:44:53 -0300 (ADT) Received: from mail-ew0-f53.google.com ([209.85.215.53]) (using TLSv1) by exprod7ob126.postini.com ([64.18.6.12]) with SMTP ID DSNKTgl4ZN4OT6F8OEdPZLyRScyP2dLrQnWP@postini.com; Mon, 27 Jun 2011 23:44:54 PDT Received: by ewy8 with SMTP id 8so1882599ewy.26 for ; Mon, 27 Jun 2011 23:44:51 -0700 (PDT) Received: by 10.14.43.150 with SMTP id l22mr4560991eeb.190.1309243491072; Mon, 27 Jun 2011 23:44:51 -0700 (PDT) Received: from [90.190.247.247] (247.247.190.90.dyn.estpak.ee [90.190.247.247]) by mx.google.com with ESMTPS id f6sm4701114eef.0.2011.06.27.23.44.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Jun 2011 23:44:49 -0700 (PDT) Message-ID: <4E09785F.8050004@enterprisedb.com> Date: Tue, 28 Jun 2011 09:44:47 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.2.17) Gecko/20110606 Icedove/3.1.10 MIME-Version: 1.0 To: Kevin Grittner CC: pgsql-hackers@postgresql.org Subject: Re: SSI modularity questions References: <4E08846E020000250003EC69@gw.wicourts.gov> In-Reply-To: <4E08846E020000250003EC69@gw.wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/2154 X-Sequence-Number: 190867 On 27.06.2011 21:23, Kevin Grittner wrote: > There are two outstanding patches for SSI which involve questions > about modularity. In particular, they involve calls to predicate > locking and conflict detection from executor source files rather > than AM source files (where most such calls exist). > > (1) Dan submitted this patch: > > http://archives.postgresql.org/message-id/20110622045850.GN83336@csail.mit.edu > > which is a very safe and very simple patch to improve performance on > sequential heap scans at the serializable transaction isolation > level. The location of the code being modified raised questions > about modularity. There is a reasonably clear place to which it > could be moved in the heap AM, but because it would acquire a > predicate lock during node setup, it would get a lock on the heap > even if the node was never used, which could be a performance > regression in some cases. The bigger question is if those calls are needed at all (http://archives.postgresql.org/message-id/4E072EA9.3030200@enterprisedb.com). I'm uneasy about changing them this late in the release cycle, but I don't feel good about leaving useless clutter in place just because we're late in the release cycle either. More importantly, if locking the whole relation in a seqscan is not just a performance optimization, but is actually required for correctness, it's important that we make the code and comments to reflect that or someone will break it in the future. > (2) In reviewing the above, Heikki noticed that there was a second > place in the executor that SSI calls were needed but missing. I > submitted a patch here: > > http://archives.postgresql.org/message-id/4E07550F020000250003EC42@gw.wicourts.gov > > I wonder, though, whether the section of code which I needed to > modify should be moved to a new function in heapam.c on modularity > grounds. > > If these two places were moved, there would be no SSI calls from any > source file in the executor subdirectory. Same here, we might not need those PredicateLockTuple calls in bitmap heap scan at all. Can you check my logic, and verify if those PredicateLockTuple() calls are needed? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com