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 1v3qqv-004bMQ-Mq for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Oct 2025 07:02:17 +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 1v3qqs-00GQCE-HY for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Oct 2025 07:02:15 +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 1v3qqs-00GQC6-7O for pgsql-hackers@lists.postgresql.org; Wed, 01 Oct 2025 07:02:14 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v3qqq-001277-0b for pgsql-hackers@lists.postgresql.org; Wed, 01 Oct 2025 07:02:14 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3f99ac9acc4so1681514f8f.3 for ; Wed, 01 Oct 2025 00:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759302131; x=1759906931; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :subject:cc:to:from:date:sender:message-id:from:to:cc:subject:date :message-id:reply-to; bh=tOePTBPZ6o/Hme81NHEoF5rFyRFlOt0+SCq+zMvObdE=; b=Q9FFXgQLXuHtg4B+dQWPGh9WKjgtIMocWynpPt/hOtsL7fl1PT6XyNwFxU+XYGaGc0 on3IciTMYJOcaNHRGtl0uT9TbcfMkgWmQl7g93XzM+zUNUUlI1WEIht9FFCKj5sZ/6eH v12jBzvdAN6Wxtd/G9xEqXRja7ma5x8Rbg8iXbTuxQMiKQRFIu1DpXK4SOcsQOZSJAlA 9IEaCBXTfMmkrpuKIGWZjeawGZ5EnZKM6f2ESM3I0ciJ+gUTQQVb7c+fGlUoSnOYJxsB P7RgDaM4V/XIK4KzzWVQHmj/dswfuuNF22oM5Hp40vGE5TvLKI/ZeZ3bR9w8c+wmP14w k0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759302131; x=1759906931; h=user-agent:in-reply-to:content-disposition:mime-version:references :subject:cc:to:from:date:sender:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=tOePTBPZ6o/Hme81NHEoF5rFyRFlOt0+SCq+zMvObdE=; b=AAB3NohUXfgpF1NIOswStOdvI9S2BM1jrNZgm4psgd18TEn+Q0X50nVl9C6ucQ5IGJ MmTF+GFJ6EkRnU4uoEyYkejfHThxci2bRUG+Zo9UtWOqF6lETAfb8+zSb5AC4hj3RtWb mgl99u2huh9Ga64mxcSoEBRWUW4Ch7YugFauKCPP9Xfwlg08VEfCLeAVlQll0+FuwVkS k6qRxPA43YedMjthTnW0C5HVUYjywxA/5yjRaM/VIzJ0HO9jMW/HfcMVt/mQ19cqDk6q 6pf6O2s5SFY6PufM6Xhd610xmQ0QME7DgRMFTrX8MEeqAumDnxo5G8Py4QfWPtFwRWV3 q4qQ== X-Forwarded-Encrypted: i=1; AJvYcCUC81uNRi76dw3EqxszL5a8N96ban4wazSVGRijZj6UYLyRMpBE4ZAfC4aokNCz4wIC/P44HIXc2D0fwwQL@lists.postgresql.org X-Gm-Message-State: AOJu0Yxa4q552m3Hmn6EBxARF9E19muDLCMBfkgu2lSDRipjXxl5YKTs 5bD37CZ+iYUkNUMvvxrZJqCgH/vim/cJug6esRGfemCgmhCtRnYz0KHY X-Gm-Gg: ASbGncussv/I+4lWgBhBYlpwGkwYwV3Ce+fbPH6pjeAxia8/u9W/ZV1qqNF47IN1UUH Jwmz4ko1p9VoACpObFfSjSXSEIwrygG25CLV4QATRV7U+ABe00NX/QpYOqnJo3kiKiCfHrkptOj cFFlPiHEuPwt8KaD+N7lMR2awKottHjuoVyfXR7fKZioOFvAIm1Zr7C93xwfGvv8oVXqDWDUPRz sJNlQ+AOh95KH+v1nrag5inJS3oYNPoJn3yfLdHVmtFme5CR64Ajw1aVIqr1G+335hnHXxUc2Oj Xk9aQwqPKWwCRIoq4hZL1zlkC4BdzxMHxQt2S8ryPm+Fr+Qod1Vuk46ZrDCNGsQvvS5IFcTBrH0 zo3SmDibiLgXVnzXD8ZVDmz6s+Clh2UbHlgRs79SANDbe1i6n/D66Qt7PzRYM1NvDp3tXQ+hgiq FRGa0= X-Google-Smtp-Source: AGHT+IHxNeqk6yXkdvLif+ngMkWLNY0oBnUxT4VCd+F7UJyrC2mGSdBuP3+ggBORSc0kKhELqdHdZA== X-Received: by 2002:a05:6000:250c:b0:3d1:c2cf:da07 with SMTP id ffacd0b85a97d-425577e4a77mr1338388f8f.4.1759302130776; Wed, 01 Oct 2025 00:02:10 -0700 (PDT) Received: from lightning.caipicrew.dd-dns.de ([2001:a61:a7f:9701:6ac6:edd8:569:5ec9]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-40fb9768bdesm25899292f8f.23.2025.10.01.00.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Oct 2025 00:02:10 -0700 (PDT) Message-ID: <68dcd1f2.df0a0220.3300c0.f7af@mx.google.com> X-Google-Original-Message-ID: <20251001070209.GK10642@caipicrew.dd-dns.de;lightning.caipicrew.dd-dns.de> Sender: Michael Banck Received: from mbanck by lightning.caipicrew.dd-dns.de with local (Exim 4.92) (envelope-from ) id 1v3qqn-0002jv-N5; Wed, 01 Oct 2025 09:02:09 +0200 Date: Wed, 1 Oct 2025 09:02:09 +0200 From: Michael Banck To: Tom Lane Cc: Aleksander Alekseev , Frits Hoogland , pgsql-hackers@lists.postgresql.org Subject: Re: The ability of postgres to determine loss of files of the main fork References: <013D63E2-5D75-492E-85FF-1D5CC0148C82@gmail.com> <499686.1759250489@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <499686.1759250489@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, wow, this is one of the most terrifying threads I've ever seen... On Tue, Sep 30, 2025 at 12:41:29PM -0400, Tom Lane wrote: > Aleksander Alekseev writes: > >> Therefore, I would like to request an enhancement: add an option to > >> verify_heapam() that causes the primary key index to be scanned and makes > >> sure that all line pointers in the index point to existing tuples. > > > ... IMO there is little value in adding a check for the existence of > > the segments for a single table. And the *real* check will not differ > > much from something like SELECT * FROM my_table, or from making a > > complete backup of the database. > > As Frits mentioned, neither of those actions will really notice if a > table has been truncated via loss of a segment. Is there a valid case for a missing segment? If not, couldn't this be caught somewhere in the storage manager? > However, I think the requested functionality already exists via > contrib/amcheck (see the heapallindexed option). It doesn't balk for me, am I doing something wrong? |mbanck@mbanck-lin-1:~$ psql -c "SELECT COUNT(*) FROM pgbench_accounts" | count |---------- | 20000000 |(1 row) | |mbanck@mbanck-lin-1:~$ rm /tmp/pg_virtualenv.h8ObRG/data/18/regress/base/5/16462.1 |mbanck@mbanck-lin-1:~$ ls /tmp/pg_virtualenv.h8ObRG/data/18/regress/base/5/16462* | grep -v 16462_ |/tmp/pg_virtualenv.h8ObRG/data/18/regress/base/5/16462 |/tmp/pg_virtualenv.h8ObRG/data/18/regress/base/5/16462.2 |mbanck@mbanck-lin-1:~$ psql -c "SELECT COUNT(*) FROM pgbench_accounts" | count |--------- | 7995392 |(1 row) | |mbanck@mbanck-lin-1:~$ /usr/lib/postgresql/18/bin/pg_amcheck -v --heapallindexed -t pgbench_accounts |pg_amcheck: including database "postgres" |pg_amcheck: in database "postgres": using amcheck version "1.5" in schema "public" |pg_amcheck: checking heap table "postgres.public.pgbench_accounts" |pg_amcheck: checking btree index "postgres.public.pgbench_accounts_pkey" |mbanck@mbanck-lin-1:~$ echo $? |0 |mbanck@mbanck-lin-1:~$ /usr/lib/postgresql/18/bin/pg_amcheck -v --heapallindexed -i pgbench_accounts_pkey |pg_amcheck: including database "postgres" |pg_amcheck: in database "postgres": using amcheck version "1.5" in schema "public" |pg_amcheck: checking btree index "postgres.public.pgbench_accounts_pkey" |mbanck@mbanck-lin-1:~$ echo $? |0 |mbanck@mbanck-lin-1:~$ And neither pg_checksums nor pg_basebackup catch it either... Michael