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 1lvh7T-0004Wj-GU for pgsql-bugs@arkaria.postgresql.org; Tue, 22 Jun 2021 14:11:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lvh7S-0005K3-63 for pgsql-bugs@arkaria.postgresql.org; Tue, 22 Jun 2021 14:11:14 +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 1lvh7R-0005Jv-Vs for pgsql-bugs@lists.postgresql.org; Tue, 22 Jun 2021 14:11:13 +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 1lvh7P-00048k-SZ for pgsql-bugs@lists.postgresql.org; Tue, 22 Jun 2021 14:11:13 +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 15MEB6oZ1715252; Tue, 22 Jun 2021 10:11:06 -0400 From: Tom Lane To: Thomas Munro cc: Heikki Linnakangas , Alexander Lakhin , PostgreSQL mailing lists Subject: Re: BUG #17064: Parallel VACUUM operations cause the error "global/pg_filenode.map contains incorrect checksum" In-reply-to: References: <17064-bb0d7904ef72add3@postgresql.org> Comments: In-reply-to Thomas Munro message dated "Wed, 23 Jun 2021 01:00:31 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1715250.1624371066.1@sss.pgh.pa.us> Date: Tue, 22 Jun 2021 10:11:06 -0400 Message-ID: <1715251.1624371066@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > Your analysis seems right to me. We have to worry about both things: > atomicity of writes on power failure (assumed to be sector-level, > hence our 512 byte struct -- all good), and atomicity of concurrent > reads and writes (we can't assume anything at all, so r/w locking is > the simplest way to get a consistent read). Shouldn't relmap_redo() > also acquire the lock exclusively? Shouldn't we instead file a kernel bug report? I seem to recall that POSIX guarantees atomicity of these things up to some operation size. Or is that just for pipe I/O? If we can't assume atomicity of relmapper file I/O, I wonder about pg_control as well. But on the whole, what I'm smelling is a moderately recently introduced kernel bug. We've been doing this this way for years and heard no previous reports. regards, tom lane