Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j081o-0003Om-J9 for pgsql-committers@arkaria.postgresql.org; Fri, 07 Feb 2020 18:06:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j081l-0007rY-Th for pgsql-committers@arkaria.postgresql.org; Fri, 07 Feb 2020 18:06:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j081l-0007rR-MN for pgsql-committers@lists.postgresql.org; Fri, 07 Feb 2020 18:06:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j081j-0002jt-2G; Fri, 07 Feb 2020 18:06:53 +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 017I6kAe021621; Fri, 7 Feb 2020 13:06:46 -0500 From: Tom Lane To: Alexander Korotkov cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Fix page modification outside of critical section in GIN In-reply-to: References: Comments: In-reply-to Alexander Korotkov message dated "Tue, 19 Nov 2019 21:19:39 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21619.1581098806.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 07 Feb 2020 13:06:46 -0500 Message-ID: <21620.1581098806@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alexander Korotkov writes: > Fix page modification outside of critical section in GIN > By oversight 52ac6cd2d0 makes ginDeletePage() sets pd_prune_xid of page = to be > deleted before entering the critical section. It appears that only vers= ions 11 > and later were affected by this oversight. I happened to notice, while reviewing stuff for the release notes, that this patch does not do what the commit message says. The previous code modified the pd_prune_xid of the "dBuffer" page, but now it's modifying the pd_prune_xid of the "lBuffer" page. Is that actually correct? If it isn't, maybe you need to move the GinPageSetDeleteXid call down a bit further, next to the GinPageSetDeleted call (by which time the "page" variable has been restored to the right thing). Another idea which would be safer if a bit more invasive is to stop using the single "page" variable for two purposes. regards, tom lane