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 1qn3E1-009mYJ-8n for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Oct 2023 20:39:37 +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 1qn3Cw-00Eiix-6J for pgsql-hackers@arkaria.postgresql.org; Sun, 01 Oct 2023 20:38: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 1qn3Cv-00Eiil-Qm for pgsql-hackers@lists.postgresql.org; Sun, 01 Oct 2023 20:38:29 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qn3Cs-007fFP-U5 for pgsql-hackers@postgresql.org; Sun, 01 Oct 2023 20:38:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 391KbPDg1867128; Sun, 1 Oct 2023 16:37:25 -0400 From: Tom Lane To: Noah Misch cc: pgsql-hackers@postgresql.org Subject: Re: pgstatindex vs. !indisready In-reply-to: <20231001195309.a3@google.com> References: <20231001195309.a3@google.com> Comments: In-reply-to Noah Misch message dated "Sun, 01 Oct 2023 12:53:09 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1867126.1696192645.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 01 Oct 2023 16:37:25 -0400 Message-ID: <1867127.1696192645@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Noah Misch writes: > Running pgstatindex on some !indisready indexes fails with "ERROR: XX00= 1: > could not read block 0 in file". This reproduces it: > ... > Since XX001 =3D ERRCODE_DATA_CORRUPTED appears in the "can't-happen" cla= ss, it's > not a good fit for this scenario. I propose to have pgstatindex fail ea= rly on > !indisready indexes. +1 > We could go a step further and also fail on > indisready&&!indisvalid indexes, which are complete enough to accept ins= erts > but not complete enough to answer queries. I don't see a reason to do t= hat, > but maybe someone else will. Hmm. Seems like the numbers pgstatindex would produce for a not-yet-complete index would be rather irrelevant, even if the case doesn't risk any outright problems. I'd be inclined to be conservative and insist on indisvalid being true too. regards, tom lane