Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnohD-0002ri-VL for pgsql-general@arkaria.postgresql.org; Wed, 17 Jul 2019 18:30:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hnohB-0002mb-LT for pgsql-general@arkaria.postgresql.org; Wed, 17 Jul 2019 18:30:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hnohB-0002mU-23 for pgsql-general@lists.postgresql.org; Wed, 17 Jul 2019 18:30:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hnoh8-0007lh-Kj for pgsql-general@postgresql.org; Wed, 17 Jul 2019 18:30:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6HIUMQA031752; Wed, 17 Jul 2019 14:30:22 -0400 From: Tom Lane To: Alvaro Herrera cc: Peter Geoghegan , Aaron Pelz , pgsql-general General Subject: Re: Corrupt index stopping autovacuum system wide In-reply-to: <20190717182138.GA25244@alvherre.pgsql> References: <20190717182138.GA25244@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 17 Jul 2019 14:21:38 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31750.1563388222.1@sss.pgh.pa.us> Date: Wed, 17 Jul 2019 14:30:22 -0400 Message-ID: <31751.1563388222@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2019-Jul-17, Peter Geoghegan wrote: >> Maybe nbtree VACUUM should do something more aggressive than give up >> when there is a "failed to re-find parent key" or similar condition. >> Perhaps it would make more sense to make the index inactive (for some >> value of "inactive") instead of just complaining. That might be the >> least worst option, all things considered. > Maybe we can mark an index as unvacuumable in some way? As far as I > understand, all queries using that index work, as do index updates; it's > just vacuuming that fails. If we mark the index as unvacuumable, then > vacuum just skips it (and does not run phase 3 for that table), and > things can proceed; the table's age can still be advanced. Obviously > it'll result in more bloat than in normal condition, but it shouldn't > cause the whole cluster to go down. If an index is corrupt enough to break vacuum, I think it takes a rather large leap of faith to believe that it's not going to cause problems for inserts or searches. I'd go with just marking the index broken and insisting that it be REINDEX'd before we touch it again. Not sure how we make that happen automatically though, or if we even should. (a) once the transaction's failed, you can't go making catalog updates; (b) even when you know the transaction's failed, blaming it on a particular index seems a bit chancy; (c) automatically disabling constraint indexes seems less than desirable. regards, tom lane