Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s7gMH-006obJ-Hz for pgsql-hackers@arkaria.postgresql.org; Thu, 16 May 2024 19:01:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s7gMH-00Da0x-Gr for pgsql-hackers@arkaria.postgresql.org; Thu, 16 May 2024 19:01:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s7gMH-00Da0p-7R for pgsql-hackers@lists.postgresql.org; Thu, 16 May 2024 19:01:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s7gME-000XYF-Qk for pgsql-hackers@postgresql.org; Thu, 16 May 2024 19:01:39 +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 44GJ1VQB2138499; Thu, 16 May 2024 15:01:31 -0400 From: Tom Lane To: Andres Freund cc: Nathan Bossart , Melanie Plageman , Thomas Munro , Michael Paquier , Fujii Masao , "pgsql-hackers@postgresql.org" Subject: Re: race condition when writing pg_control In-reply-to: <20240516185805.hnbt2tr23q7xbx3m@awork3.anarazel.de> References: <20200527071053.GD103662@paquier.xyz> <20200602052427.GC3594@paquier.xyz> <20200603020259.GA89559@paquier.xyz> <20240516183558.GA1620903@nathanxps13> <2136775.1715885450@sss.pgh.pa.us> <20240516185805.hnbt2tr23q7xbx3m@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 16 May 2024 11:58:05 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2138497.1715886091.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 16 May 2024 15:01:31 -0400 Message-ID: <2138498.1715886091@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2024-05-16 14:50:50 -0400, Tom Lane wrote: >> The intention was certainly always that it be atomic. If it isn't >> we have got *big* trouble. > We unfortunately do *know* that on several systems e.g. basebackup can r= ead a > partially written control file, while the control file is being > updated. Yeah, but can't we just retry that if we get a bad checksum? What had better be atomic is the write to disk. Systems that can't manage POSIX semantics for concurrent reads and writes are annoying, but not fatal ... regards, tom lane