Re: room for improvement in amcheck btree checking?

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: room for improvement in amcheck btree checking?
Date: 2020-12-01 23:26:53
Message-ID: 20201201232653.GA5727@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-Dec-01, Mark Dilger wrote:

> 7) Run a SQL query that uses an index scan on the table and see that it errors with something like:
>
> ERROR: could not read block 0 in file "base/13097/16391": read only 0 of 8192 bytes
>
> I found it surprising that even when precisely zero of the tids in the
> index exist in the table the index checks all come back clean.

Yeah, I've seen this kind of symptom in production databases (indexes
pointing to non-existant heap pages).

I think one useful cross-check that amcheck could do, is verify that if
a heap page is referenced from the index, then the heap page must exist.
Otherwise, it's a future index corruption of sorts: the old index
entries will point to the wrong new heap tuples as soon as the table
grows again.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-12-01 23:51:42 Re: [DOC] Document concurrent index builds waiting on each other
Previous Message Tom Lane 2020-12-01 23:07:17 Re: Recent eelpout failures on 9.x branches