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 1qoAbX-000Nip-JS for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Oct 2023 22:44:32 +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 1qoAbV-0069Zk-E5 for pgsql-bugs@arkaria.postgresql.org; Wed, 04 Oct 2023 22:44:30 +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 1qoAbT-0069Zc-M1 for pgsql-bugs@lists.postgresql.org; Wed, 04 Oct 2023 22:44:30 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qoAbQ-0003HX-T1 for pgsql-bugs@lists.postgresql.org; Wed, 04 Oct 2023 22:44:27 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 323193200A0E; Wed, 4 Oct 2023 18:44:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 04 Oct 2023 18:44:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1696459461; x=1696545861; bh=Qq C7sL4OcHvVz47vCGyKXs6CwYYg3Mc4UvvBzjgI6wk=; b=QjGw+FoWGylIIWhBOx l4ny4aBu7dGsq5julAZwcw93L8puQ9dVXRYpQQ1VV4cRtU7eXVY8BDOKFUwBB3ds KQrgerAArvahW9Ftnb0+jSvn9pM/41Ci39H/nU03wnm+d9ZJexnoZjGOzvNq+n+y 7pKpWwynUARFKATagRarKqZuNOHHICHSlmA/yLo0I4I/7/wSnm5fgqpwVuZIGdt3 GIsluWHFoovAgx6ubsx/mcpM6t5ObxDky/OcDJrdomVMAdHQsDekhSNck8HmR/Dx xjwThppfrPLGfWnuz7xVad6HvykE+meBgFmXOO5x4yOzv0+CarPAx7Xt6RgmDbWB WnPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1696459461; x=1696545861; bh=QqC7sL4OcHvVz 47vCGyKXs6CwYYg3Mc4UvvBzjgI6wk=; b=CYK9f2s9+vl/8DCme2Kf1OxtCKHbT H2sszLI8KRglE5+uaRmo16wVh/nVbVlWbd6rYJnZbsgYlgYpDCutofLycl3786WP 2dV2a2mU+706PK/yosnSND24PoZl0fwn3Dn0dbv05Gpe7Yl73FQsAVDP7buAax5m ZwlkSmBD5ZJFS6XIMhOyvmnS3/PmMyohCIoMth9TDNmD1SjKdAFxnAHALWlw6C8+ ol7bnlV4yaPpUbU4UZQzrhdIjn0eEVGQLMJqYHV0YSv4U+KtHdiu8SLuwsrlSIT/ JnH+BuyumTVuOZYtJkrHtSWYEu4dms/sGfJqemazsEUmUmlsRZTRX1DNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrgeefgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculddvfedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt jeenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeejieegheevjedvgeektdegveej ueegheeljeeggeffvdfhjeefffeigfejjedvfeenucffohhmrghinhepphhoshhtghhrvg hsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 4 Oct 2023 18:44:18 -0400 (EDT) Date: Thu, 5 Oct 2023 07:44:14 +0900 From: Michael Paquier To: Thomas Munro Cc: Tom Lane , Laurenz Albe , rootcause000@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18146: Rows reappearing in Tables after Auto-Vacuum Failure in PostgreSQL on Windows Message-ID: References: <18146-04e908c662113ad5@postgresql.org> <9fc4118d2a8f2290d8598a9c4d451c4c90b17cee.camel@cybertec.at> <2583426.1696429441@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NYxcb7/XBnJw39AD" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --NYxcb7/XBnJw39AD Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 05, 2023 at 10:12:27AM +1300, Thomas Munro wrote: > On Thu, Oct 5, 2023 at 3:26=E2=80=AFAM Tom Lane wrote: >> I'm too lazy to check the commit log right now, but I think >> we did implement a fix for that (ie, flush dirty pages even >> if we anticipate them going away due to truncation). But as >> Laurenz says, v10 is out of support and possibly didn't get >> that fix. Even if it did, you'd need to be running one of >> the last minor releases, because this wasn't very long ago. > > This thread seems to be saying otherwise: >=20 > https://www.postgresql.org/message-id/flat/2348.1544474335%40sss.pgh.pa.us Yeah, that's not been solved. I've put my mind on this problem for a few hours last May, just before PGCon, and there was an argument that marking all the pages as dirty is kind of a waste of resources as it would create WAL for data that's going to be gone a little bit later as an effect of the truncate, leading to an extra burst of I/O especially for large truncatoins. FWIW, I think that I'd be personally OK with using this method. At least that's safe, simple, backpatchable and it does not require any new magic. I know that there are voices that argued against this method, but here we are N years later, so perhaps we should just do that on HEAD at least. >> In the end though, the *real* problem here is running on a >> platform that randomly disallows writes to disk. There's only >> so much that Postgres can possibly do about unreliability of the >> underlying platform. I would never run a production database on >> Windows, because it's just too prone to that sort of BS. >=20 > It's surprising that ftruncate() AKA chsize() is able to fail like > this (I am not a Windows user but AFAIR that sharing stuff obstructs > stuff like open, unlink, rename, so it surprises me to see it come up > with ftruncate, since we must already have made it past the open > stage). Hmm, the documentation is scant, but I know from my attempts > to use large files that chsize() is probably some kind of wrapper > around SetEndOfFile() or similar, and that is documented as failing if > someone has the file mapped. I don't know why someone would have the > file mapped, though. (shrug) > But as for what we should do about it, PANIC (as suggested by several > people) seems better than corruption, if we're not going to write some > kind of resilience? How else are we supposed to deal with "this > shouldn't happen, and if it does we're hosed?" A PANIC may be OK for this specific syscall and would be better, but the problematic area is larger than that as we'd still finish with a corruption as long as there's an ERROR or a FATAL between the moment the buffers (potentially dirty, with live-still-dead-in-memory tuples on disk) are discarded and the moment the truncation fails. Another method discussed is the use of a critical section (I recall that there were some pallocs in this area, actually, but got nothing on my notes about that...).=20 -- Michael --NYxcb7/XBnJw39AD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmUd6r4ACgkQnvQgOdby QH2iDQ//auHyQVNKy8oNpEq44vAJ6zAbtzHSWrOIbUXgwTR+1YA8Mh9hUWyTbSuw airRNc6OXtAlOyC6Ebdq3gOGHLW6xPjyuafAQWGsF/+k+gectwnu2zULJjDgF0cs vcW5uOIO7VmP2O0+pp8uBPR2oQ4iosDjO+XpGB08y/7w5EixjeiStRwwwGBan/Fi 2OEGTWwPHDR19/ks1IBBPA3a20y0sqYRYI6plsrwWVfpyPOxGN27Cn2J8sNAZq+G axhkz4bpkLiUTzu885ecH2D/9LAsPcgqmL5DsZp5qx19RpGKtVH/wJFwzjaMzZzP BopOJrbFCv585DoIhd5eNEtUZiiEdvTqmuPmyRNvLzLZLymiQ5wZYlKvbu1ggLSK DWJdpdSbTRrq4NlRcyRC1xIgAoYpFgvT9Z8is4ktSCoJIMP0mVhq0smpSF/T7tuJ ZNckJpVcj8UtrHfRK/vjnPLjD2KY2T0ScrihQu0FxA+4H8RERMNMzdLZGosnzB7z +TrIUZD0JbFKlqK7GAW+LlGsuAUehfHoG4EGFGJO+UYiLNZ+dlKm4ZhNt7GzRu9/ 4ayV8/Euh9Aw3uuQtNMafQDpXBTgfmc8IJR9ZcGO5NeL4n/HmxHPTSgyrO1VpGmi 1LbOQD8IbpuXTqC+uhnNLOjO/V7Eii4uSKacNj5qAinQYhhNxhI= =qHN1 -----END PGP SIGNATURE----- --NYxcb7/XBnJw39AD--