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 1ruozS-007qaw-Og for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Apr 2024 07:36:59 +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 1ruozR-00EZCq-Gp for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Apr 2024 07:36:57 +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 1ruozR-00EZ9h-6v for pgsql-bugs@lists.postgresql.org; Thu, 11 Apr 2024 07:36:57 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ruozN-000Kxo-O3 for pgsql-bugs@lists.postgresql.org; Thu, 11 Apr 2024 07:36:56 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-516d0c004b1so8991282e87.2 for ; Thu, 11 Apr 2024 00:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=google; t=1712821012; x=1713425812; 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=nE2+wHdUnuUn4S2ElGRUCjP6Ji+G3wTEC7dEKJDYrNI=; b=KUk0vYH800Jkm+pdHeHW1QXKrQXYP228zf6muXKZrPaUsxyQzFTPsicfqqcytHo74k j8zh84j0w/cwxwj6grdM9FoZ9ODfKEBOiYt1qbq8raVq893dUfRlLx2Ta9wdaoUnijZ0 ruE6tf0V05rDj3JpDNaRMDQ3MJTW19Be51JM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712821012; x=1713425812; 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=nE2+wHdUnuUn4S2ElGRUCjP6Ji+G3wTEC7dEKJDYrNI=; b=tU+FzJMbO9xk08a6PwSxcTjASHdjPBnYjDfqmZ8q2AZPtLYZDsEVPE86y4w6r+1Vtq Wq5Wx2eJqEjTiqtBBpJiRHWcfcwAqzz8EqxqQfEpsSvBJKWVEppthoQfggqAhh/J6xN8 fiQl8FKILjuWWEuoKvUnPaRVAS3CSj09Q9BTrGb7yvpBMij4yh+oKKdVY4s5ScdOp1VI N0ghYMRSFbcV+3sySiuPKi5HzlBsge4bhJYWqO8FZ36plY16n1D9NGpoZiiiBWMzQue1 2g9o9NrDXlbOBokCmxwouPtlw3lrRt8pf2MVeqb6jrq4UltiSoKTw/wkgVnvid5xdI9y +AdQ== X-Forwarded-Encrypted: i=1; AJvYcCUVlOPM5oDL/YHvkKAxlUDNCjhrPAa0OzC1qxBOgUMTu9hNI/QLCeGZFg03AvmGJ6CTOkOOEMiB4BnuNZs28Si4TVOLstinalzk/5rKc151 X-Gm-Message-State: AOJu0YxkrF4DHpHv9Mm5IoouDE0CQbWhMTmXlyTtrOctzCopkGXW5rM4 qvFw3rpLNcI2jIJBnI2jDda0ZQvZZggNkU/E11429LOoGFTCGAUHKVdwjyaVI/1AaHhb+Gfs/TH HPWY= X-Google-Smtp-Source: AGHT+IGeeDxgv0lzI5MxHBG4pkrXogqufnJe4Oy+5cNXae5lixokXzQ7DVCrX43YBkhKGH9LPdsHzQ== X-Received: by 2002:a05:6512:21d:b0:516:c41f:b0fc with SMTP id a29-20020a056512021d00b00516c41fb0fcmr3254216lfo.58.1712821012045; Thu, 11 Apr 2024 00:36:52 -0700 (PDT) Received: from aivenlaptop.localnet ([45.13.105.93]) by smtp.gmail.com with ESMTPSA id g4-20020adfa484000000b0034330c9eccasm1113899wrb.79.2024.04.11.00.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 00:36:51 -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: Thu, 11 Apr 2024 09:36:50 +0200 Message-ID: <5959995.31r3eYUQgx@aivenlaptop> In-Reply-To: <20240406223037.c5@rfd.leadboat.com> References: <6055942.lOV4Wx5bFT@aivenlaptop> <20240406223037.c5@rfd.leadboat.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 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-logging of = =46SM > and VM truncation". That commit's 008_fsm_truncation.pl fails with 917dc= 7d > 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 g= o. > Thank you Noah, the updated comments are much better. I think it should be= =20 backported at least to 16 since the chances of tripping on that behaviour a= re=20 quite high here, but what about previous versions ? > While updating comments in FreeSpaceMapPrepareTruncateRel(), I entered a > rabbit hole about the comments 917dc7d left about torn pages. I'm sharing > these findings just in case it helps a reader of the $SUBJECT patch avoid > the same rabbit hole. Both fsm and vm read with RBM_ZERO_ON_ERROR, so I > think they're fine with torn pages. Per the README sentences I'm adding, > FSM could stop writing WAL. I'm not proposing that, but I do bet it's the > right thing. visibilitymap_prepare_truncate() has mirrored fsm truncate > since 917dc7d. The case for removing WAL there is clearer still, because > parallel function visibilitymap_clear() does not write WAL. I'm attaching > a WIP patch to remove visibilitymap_prepare_truncate() WAL. I'll abandon > that or pursue it for v18, in a different thread. That's an interesting finding. > If I were continuing the benchmark study, I would try SSD, a newer kernel, > and/or shared_buffers=3D48GB. Instead, since your perf results show only > +0.01% CPU from new lseek() calls, I'm going to stop there and say it's > worth taking the remaining risk that some realistic scenario gets a > material regression from those new lseek() calls. Agree with you here. Many thanks, =2D- Ronan Dunklau