Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJl66-0007ee-KY for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Aug 2022 00:21:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJl64-0006jm-6z for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Aug 2022 00:21:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJl63-0006ci-T4 for pgsql-hackers@lists.postgresql.org; Fri, 05 Aug 2022 00:21:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJl5y-0006bb-1m for pgsql-hackers@lists.postgresql.org; Fri, 05 Aug 2022 00:21:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2750LQhj3696677; Thu, 4 Aug 2022 20:21:26 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , Dilip Kumar , Justin Pryzby , Ashutosh Sharma , Maciek Sakrejda , Bruce Momjian , Alvaro Herrera , Andrew Dunstan , Heikki Linnakangas , PostgreSQL Hackers , Thomas Munro Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints In-reply-to: <71BB0D91-0308-4134-BCDB-4D2567B27569@anarazel.de> References: <20220802175043.GA13682@telsasoft.com> <2767668.1659476794@sss.pgh.pa.us> <20220802220416.GC13682@telsasoft.com> <20220802222334.umf5wsa2r63koppn@awork3.anarazel.de> <3663919.1659650570@sss.pgh.pa.us> <3679800.1659654066@sss.pgh.pa.us> <3681339.1659654673@sss.pgh.pa.us> <71BB0D91-! 0308-4134-BCDB-4D2567B27569@anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 04 Aug 2022 16:59:22 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3696675.1659658886.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 04 Aug 2022 20:21:26 -0400 Message-ID: <3696676.1659658886@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On August 4, 2022 4:11:13 PM PDT, Tom Lane wrote: >> [pile^2] Also, what is the rationale for locking the target buffer >> but not the source buffer? That seems pretty hard to justify from >> here, even granting the assumption that we don't expect any other >> processes to be interested in these buffers (which I don't grant, >> because checkpointer). > I'm not arguing it's good or should stay that way, but it's probably oka= yish that checkpointer / bgwriter have access, given that they will never = modify buffers. They just take a lock to prevent concurrent modifications,= which RelationCopyStorageUsingBuffer hopefully doesn't do. = I'm not arguing that it's actively broken today --- but AFAIR, every other access to a shared buffer takes a buffer lock. It does not seem to me to be very future-proof for this code to decide it's exempt from that rule, without so much as a comment justifying it. Furthermore, what's the gain? We aren't expecting contention here, I think. If we were, then it probably *would* be actively broken. regards, tom lane