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 1rwEyc-000SA1-G8 for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Apr 2024 05:33:58 +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 1rwEya-00AgIX-PA for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Apr 2024 05:33:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwEya-00AgIP-Ej for pgsql-bugs@lists.postgresql.org; Mon, 15 Apr 2024 05:33:56 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rwEyX-0010uU-3P for pgsql-bugs@lists.postgresql.org; Mon, 15 Apr 2024 05:33:55 +0000 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-41877b4d638so145305e9.0 for ; Sun, 14 Apr 2024 22:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=google; t=1713159231; x=1713764031; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DDsE1LFixrWOV5pzRGwXL0e3aSGuOFxxSwRR7uokE4M=; b=fn1GEBSiKbLaHMXJWoAlPn/VtiZDn90CT+FhSbmCdk7rILFioKf66+3csiq0t6gJAK iA1PT3u6/iOB6I48D2S26JxDOW+r8p7kXbLAhYDvrqdwpY/kQ/ylxQ1ji6sMIdWlrku/ w3retjmu7syBKGzsKK2Ye/cTQhKiSy33gSQ+o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713159231; x=1713764031; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DDsE1LFixrWOV5pzRGwXL0e3aSGuOFxxSwRR7uokE4M=; b=jDhxUW4eHyU3ydns/HvtP8/n5/hfKR0grF5f5sYubPQ74B26Ii/h6Xu/bHJwqPa+gi BCY+Zyj8FIJnEOC+BFZdSa1bIpnt3I/SXxpa4ua9pgnK0JVJ8bfuUroypogYwJLruPe/ hKroH8FSRXgK529T83RiMfklRxJHrV6he9GAFlZ0xgP2VntXnSJJ7tHq0QzFwHa19jTa awWcpFFtxvg8vAmgtQkY86bfAK1izbzFLL6Pl5qW1gx1FjP1KRCjGmVy1iGMRjfb70pP JFyt2nKMikDQEeG3ThLgFfcPDU7hqZY7gkpW/IXe9IlorR84LCK4yjMsBqOlQNMyd2+p MwuQ== X-Forwarded-Encrypted: i=1; AJvYcCUSjIALYaTlRJpDYYT4yzzQ/Au2RaQybyFVr5BuwS3Tbnw7QlBk1V0mAY+idcgGBIATWGKC7mBd2jqHE7gli9R9j/t8BipGpR99tZCjZjgx X-Gm-Message-State: AOJu0Ywlag3sB09KpXgKrOLNu0HJ92DvNtO1vTK+NL/GWnjt5L/fxejr eHoC/uQlxLZRCC/4m7/DmjY6mUfZJe8dJXUeLKIccOUauiYncGR7Ib5EkoPqIS6ikt712x3DxI/ F X-Google-Smtp-Source: AGHT+IEv15GGom58AiRd50Xb1k9JnD/BwXL0s5AOslSO8XqcIXEKpKboqsBUwyrL3JXFuxHnz0TedA== X-Received: by 2002:a05:600c:45cc:b0:417:bc16:b8f1 with SMTP id s12-20020a05600c45cc00b00417bc16b8f1mr7345416wmo.12.1713159230911; Sun, 14 Apr 2024 22:33:50 -0700 (PDT) Received: from aivenlaptop.localnet ([45.13.105.93]) by smtp.gmail.com with ESMTPSA id gw7-20020a05600c850700b004146e58cc35sm18179416wmb.46.2024.04.14.22.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 22:33:50 -0700 (PDT) From: Ronan Dunklau To: Noah Misch Cc: Michael Paquier , pgsql-bugs Subject: Re: FSM Corruption (was: Could not read block at end of the relation) Date: Mon, 15 Apr 2024 07:33:49 +0200 Message-ID: <12418161.O9o76ZdvQC@aivenlaptop> In-Reply-To: <20240413171528.59.nmisch@google.com> References: <20240411153843.20@rfd.leadboat.com> <20240413171528.59.nmisch@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Le samedi 13 avril 2024, 19:15:28 CEST Noah Misch a =C3=A9crit : > On Thu, Apr 11, 2024 at 08:38:43AM -0700, Noah Misch wrote: > > On Thu, Apr 11, 2024 at 09:36:50AM +0200, Ronan Dunklau wrote: > > > Le dimanche 7 avril 2024, 00:30:37 CEST Noah Misch a =C3=A9crit : > > > > Your v3 has the right functionality. As further confirmation of the > > > > fix, I > > > > tried reverting the non-test parts of commit 917dc7d "Fix WAL-loggi= ng > > > > of FSM and VM truncation". That commit's 008_fsm_truncation.pl fai= ls > > > > with 917dc7d reverted from master, and adding this patch makes it > > > > pass again. I ran pgindent and edited comments. I think the > > > > attached version is ready to go.> >=20 > > > Thank you Noah, the updated comments are much better. I think it shou= ld > > > be > > > backported at least to 16 since the chances of tripping on that > > > behaviour are quite high here, but what about previous versions ? > >=20 > > It should be reachable in all branches, just needing concurrent extensi= on > > lock waiters to reach before v16. Hence, my plan is to back-patch it a= ll > > the way. It applies with negligible conflicts back to v12. >=20 > While it applied, it doesn't build in v12 or v13, due to smgr_cached_nblo= cks > first appearing in c5315f4. Options: >=20 > 1. Back-patch the addition of smgr_cached_nblocks or equivalent. > 2. Stop the back-patch of $SUBJECT at v14. > 3. Incur more lseek() in v13 and v12. >=20 > Given the lack of reports before v16, (3) seems too likely to be a cure > worse than the disease. I'm picking (2) for today. We could do (1) > tomorrow, but I lean toward (2) until someone reports the problem on v13 = or > v12. The problem's impact is limited to DML giving ERROR when it should > have succeeded, and I expect VACUUM FULL is a workaround. Without those > mitigating factors, I would choose (1). >=20 > Pushed that way, as 9358297. I agree with you that option 2 seems to be the safest course of action. For= =20 the record, other available options when that happens is to stop PG and=20 manually remove the FSM from disk (see https://wiki.postgresql.org/wiki/ =46ree_Space_Map_Problems) or adapt the patch submitted here https:// www.postgresql.org/message-id/flat/5446938.Sb9uPGUboI%40aivenlaptop to do i= t=20 online.=20 Thank you for all your work with refining, testing and finally comitting th= e fix. Best regards, =2D- Ronan Dunklau