Thread: pgsql: Add defenses to btree and hash index AMs to do simple sanity

pgsql: Add defenses to btree and hash index AMs to do simple sanity

From
tgl@svr1.postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Add defenses to btree and hash index AMs to do simple sanity checks
on every index page they read; in particular to catch the case of an
all-zero page, which PageHeaderIsValid allows to pass.  It turns out
hash already had this idea, but it was just Assert()ing things rather
than doing a straight error check, and the Asserts were partially
redundant with PageHeaderIsValid anyway.  Per recent failure example
from Jim Nasby.  (gist still needs the same treatment.)

Modified Files:
--------------
    pgsql/src/backend/access/hash:
        hash.c (r1.81 -> r1.82)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hash.c.diff?r1=1.81&r2=1.82)
        hashinsert.c (r1.39 -> r1.40)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hashinsert.c.diff?r1=1.39&r2=1.40)
        hashovfl.c (r1.47 -> r1.48)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hashovfl.c.diff?r1=1.47&r2=1.48)
        hashpage.c (r1.52 -> r1.53)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hashpage.c.diff?r1=1.52&r2=1.53)
        hashsearch.c (r1.41 -> r1.42)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hashsearch.c.diff?r1=1.41&r2=1.42)
        hashutil.c (r1.42 -> r1.43)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/hash/hashutil.c.diff?r1=1.42&r2=1.43)
    pgsql/src/backend/access/nbtree:
        nbtinsert.c (r1.127 -> r1.128)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtinsert.c.diff?r1=1.127&r2=1.128)
        nbtpage.c (r1.88 -> r1.89)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtpage.c.diff?r1=1.88&r2=1.89)
        nbtree.c (r1.132 -> r1.133)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtree.c.diff?r1=1.132&r2=1.133)
    pgsql/src/include/access:
        hash.h (r1.63 -> r1.64)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/hash.h.diff?r1=1.63&r2=1.64)
        nbtree.h (r1.87 -> r1.88)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/access/nbtree.h.diff?r1=1.87&r2=1.88)

Re: pgsql: Add defenses to btree and hash index AMs to do simple sanity

From
Tom Lane
Date:
Neil Conway <neilc@samurai.com> writes:
> On Sun, 2005-06-11 at 15:29 -0400, Tom Lane wrote:
>> (gist still needs the same treatment.)

> If you're planning on doing the same for GiST (or if there's some reason
> it can't easily be done), let me know -- otherwise I'll look into doing
> that.

I'm on it now, just felt like committing what I had ...

            regards, tom lane

Re: pgsql: Add defenses to btree and hash index AMs

From
Neil Conway
Date:
On Sun, 2005-06-11 at 15:29 -0400, Tom Lane wrote:
> Add defenses to btree and hash index AMs to do simple sanity checks
> on every index page they read [...]
> (gist still needs the same treatment.)

If you're planning on doing the same for GiST (or if there's some reason
it can't easily be done), let me know -- otherwise I'll look into doing
that.

-Neil