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 1lvqqd-0007vM-68 for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Jun 2021 00:34:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lvqq6-0008Jw-JU for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Jun 2021 00:33:58 +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 1lvqq6-0008Jo-D3 for pgsql-bugs@lists.postgresql.org; Wed, 23 Jun 2021 00:33:58 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lvqq4-0000tz-Iz for pgsql-bugs@lists.postgresql.org; Wed, 23 Jun 2021 00:33:58 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 634D19DE; Tue, 22 Jun 2021 20:33:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 22 Jun 2021 20:33:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=sJw1BHI19DXDzi/w3z+HyVdwriw OfqvTB8dociEd4hU=; b=kXma1pjw1sPMx2UovIFy4sQuSj4AYH+3YjTIOtRoy+3 9N3JuTBr4zt4jRsIJ8SDYj6JDhzeVXGzJsxLmAqFq3+N4t2Dw8OepNaSeWOS3QlM 9MVkkrJSRz0xNSlowMJnnbkQc8H2vZK2nDLeKXI+rB7pM4EgFc1w1ue+bwg8Ieqc vk1qZvvD6u+D4tOsTZVWS3ge0EuM4v/XdJhTZWcUF/Dj8p6JawGJKi/Cd8VFCNKp LoVNOWm4ohsu1uCu8rbvGVxtP6TMx4ohIQ9v9WxDk1EPW+y2w5RtNei6eckjMrdX Pt/q3YMheWU/MdYCB9aSE0Udgg4hw/b0BN9L08bWz4Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=sJw1BH I19DXDzi/w3z+HyVdwriwOfqvTB8dociEd4hU=; b=eT5C4hUWumsZTpMDgKrPIz ccY3si26Htl+Z3aGdjio/wU4rZid3SkemvaHYoFO8qj/t41ghNdWoqGXOpbvx5lz 8x2VoSoSE38bjf+RrjggCEEtYGVIMPX1RnAgnM43GyWSeCbBeKHtRBS9D+wUHx7P cAT5WOQD67msNCSvvn5mzySW4vrK08dT/r8YQIKCpPRGZbH8XbfafdNiHCaOVB3c TGTNvk78jlgTo7MYn7HAMBsyet7cBB0lk87dC+y7NiLb2JhMXinxiioyZYQNf79e C29NMgs1Vu7lPdhS4Xt9tQ9GaCPllSDfx6YZPI9D24cT67qpa1ld1huNSthS7tsA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeegvddgfeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 22 Jun 2021 20:33:51 -0400 (EDT) Date: Wed, 23 Jun 2021 09:33:47 +0900 From: Michael Paquier To: Tom Lane Cc: Thomas Munro , Heikki Linnakangas , Alexander Lakhin , PostgreSQL mailing lists Subject: Re: BUG #17064: Parallel VACUUM operations cause the error "global/pg_filenode.map contains incorrect checksum" Message-ID: References: <17064-bb0d7904ef72add3@postgresql.org> <1715251.1624371066@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xtb97sJ/c4s+k8vM" Content-Disposition: inline In-Reply-To: <1715251.1624371066@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --xtb97sJ/c4s+k8vM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 22, 2021 at 10:11:06AM -0400, Tom Lane wrote: > 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? You are implying anything calling write_relmap_file(), right? > 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? Even if this is recognized as a bug report, it seems to me that we'd better cope with an extra lock for instances that may run into this issue anyway in the future, no? Just to be on the safe side. > 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. True. PG_CONTROL_MAX_SAFE_SIZE relies on that. Now, the only things updating the control file are the startup process and the checkpointer so that's less prone to conflicts contrary to the reported problem here, and the code takes a ControlFileLock where necessary. -- Michael --xtb97sJ/c4s+k8vM Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmDSgWsACgkQnvQgOdby QH2BRA//f6fxg5xtWmDBU0Z2Ogs7vBrkSh0OnuHT1nrItZI4fls/xPVZsPjnrdln 2jsEqmJOuAdyYadHb4PPahN4AvjDP/vLlnZyPsSToYBnuf9WIm7VDpXCU3w/Gdlj 2lQTjsZi10wMSSsrusA+ZAxxbgAkJ171hB9GA54PhLEuv4vHKWpecoORpJe6SkGk V9CC75WjYQto3dy224UYlf7CId9EGI9QGzs6XlZeWVsU5HIFLZj/+lX4RCsKh1wG w/ZSowFqPGskDndNXAn0oU4vz1M16Vak5isg43/UzWJzg7q+FUs1zrSemKBM4EHJ OewIOTvkAFCEHj2kp2qdMRtsXWqG7XcX5g/RW6r0gf90cyU/8zYpcWXlNyJuKxjA 9meuJH0usG7odGTJuXlpkVdiW2XMopiaFN5kSZCaQ+hmfwAGEHUDaN7PlcLXmi76 IlAK8zZHDORDKw0MahRr/BtJk+kLMzOWK+ABUQbSHicKfoMIki7q5QLtJNWexk6l dwR6ODnULSD5R5hkF6V11+SCCvjsgYDoMxmHs0UiEvzbtELmRoDf6tR+lhvbEAvE WIbIJikPFs4823/3ULE/cuXa842TVqOuWA50XvmC5XFoyvYSrXE6ido1h/60ov3F rgu3xpcDILnokqDvwAfDXC+Z+4UtK7IkashW7+Nkkxl6JssOQc0= =2LMr -----END PGP SIGNATURE----- --xtb97sJ/c4s+k8vM--