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 1rvgyY-00DcJY-3m for pgsql-bugs@arkaria.postgresql.org; Sat, 13 Apr 2024 17:15:38 +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 1rvgyV-0055Rl-HJ for pgsql-bugs@arkaria.postgresql.org; Sat, 13 Apr 2024 17:15:35 +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 1rvgyV-0055Rd-0C for pgsql-bugs@lists.postgresql.org; Sat, 13 Apr 2024 17:15:35 +0000 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rvgyS-002gob-D4 for pgsql-bugs@lists.postgresql.org; Sat, 13 Apr 2024 17:15:33 +0000 Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-dc742543119so1750470276.0 for ; Sat, 13 Apr 2024 10:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1713028531; x=1713633331; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=z0kBOS01sH0hA67M5egWJh7DuxatHiTcXnQQQHr7Too=; b=Oxa+XrGGHadwbCgE58CZEYX/H1vsJH2w1OHtaX3XUaZvEdwSR3uKvdZTz9R13lyPzu Xbus9xowaHU4O1pfi2aeTNsVA4ZBRjRcfu5/16zDUMDhkbwSU6wIa7wWZNC1a7jdstgJ tlnIkCiqW01KrA9khnSzVztG2WmR+TWT4ZB5Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713028531; x=1713633331; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z0kBOS01sH0hA67M5egWJh7DuxatHiTcXnQQQHr7Too=; b=TjUakaSPTqTEF8Re7LJJlfNmPF7Z/wbWBNrebUq3ioG40XOK0t/2tQOMOD0QEWykRW hPvg97VNwJfYlIsIFc85PvweaVGflbk/Egkk50YXjgE2pxvVtZCzMLL32oQfLFPIiX5I k9t7s1nu2MUS78GBiuatdQCIp4caj9l5qlppNSwP/ZcPymkUhCU3ZK765p/oDfuqeIYX /PWDklAw06Ra9cYENYerJI0yLZDKkOV2o+N1UcDtN6nd5xViYsD4dy180GzQpP3VxeaK ugI07EMlYCPOF/JOrTiq05M7jNFpoQTkTAHczT3q+K1/xPJ7kV+97CzfeJoWxmL47hZG 06vQ== X-Forwarded-Encrypted: i=1; AJvYcCXJ7F1NeRr4NE6rIFDJbEg7K53xMN7+olRb49HVUV7qfZIX2BxLAU4FSP8R2hYSg39E9pMy0uYJB/EQNMTuKORMUSbibOYWgoLdeLVv31Kk X-Gm-Message-State: AOJu0YwFSYqIQvSCO9ooipGEAJI/4ynAj7xzzN6Kv3Xe/uLpv3pQ4k0X 1P0Kf1x7WeifJrB0OA6JfmRKbzwYV+rHjUDrwD65KvR5ixVbmLx+Cp/D5qyOBBoOZwXT97h5fjg = X-Google-Smtp-Source: AGHT+IFjwByBFV4B5ILnD64qiC2uJFzU+9Uk4QjlUatsI7d6RRQzSquVwNLRqKvYwUvLKMNM69twnw== X-Received: by 2002:a25:8211:0:b0:de1:1af9:c7ea with SMTP id q17-20020a258211000000b00de11af9c7eamr4908503ybk.1.1713028531243; Sat, 13 Apr 2024 10:15:31 -0700 (PDT) Received: from google.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id 71-20020a250b4a000000b00dcd3487c8f5sm1265441ybl.12.2024.04.13.10.15.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Apr 2024 10:15:30 -0700 (PDT) Date: Sat, 13 Apr 2024 10:15:28 -0700 From: Noah Misch To: Ronan Dunklau Cc: Michael Paquier , pgsql-bugs Subject: Re: FSM Corruption (was: Could not read block at end of the relation) Message-ID: <20240413171528.59.nmisch@google.com> References: <6055942.lOV4Wx5bFT@aivenlaptop> <20240406223037.c5@rfd.leadboat.com> <5959995.31r3eYUQgx@aivenlaptop> <20240411153843.20@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240411153843.20@rfd.leadboat.com> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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 écrit : > > > Your v3 has the right functionality. As further confirmation of the fix, I > > > tried reverting the non-test parts of commit 917dc7d "Fix WAL-logging of FSM > > > and VM truncation". That commit's 008_fsm_truncation.pl fails 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. > > > > Thank you Noah, the updated comments are much better. I think it should be > > backported at least to 16 since the chances of tripping on that behaviour are > > quite high here, but what about previous versions ? > > It should be reachable in all branches, just needing concurrent extension lock > waiters to reach before v16. Hence, my plan is to back-patch it all the way. > It applies with negligible conflicts back to v12. While it applied, it doesn't build in v12 or v13, due to smgr_cached_nblocks first appearing in c5315f4. Options: 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. 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). Pushed that way, as 9358297.