| From: | Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> | 
|---|---|
| To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> | 
| Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: pg_verify_checksums failure with hash indexes | 
| Date: | 2018-08-29 10:00:14 | 
| Message-ID: | 20180829190014.bbb2f3ccc4dc3dddb57d71c7@sraoss.co.jp | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Wed, 29 Aug 2018 14:39:10 +0530
Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Tue, Aug 28, 2018 at 2:51 PM Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> >
> > This is reproducible with PG11 and PG12:
> >
> > initdb -k data
> > postgres -D data
> >
> > make installcheck
> > # shut down postgres with Ctrl-C
> >
> ..
> >
> > The files in question correspond to
> >
> > hash_i4_index
> > hash_name_index
> > hash_txt_index
> >
> 
> I have looked into this problem and found the cause of it.  This
> problem is happening for the empty page in the hash index.  On a
> split, we allocate a new splitpoint's worth of bucket pages wherein we
> initialize the last page with zero's, this is all fine, but we forgot
> to set the checksum for that last page.  Attached patch fixes the
> problem for me.
> 
> Can someone try and share their findings?
I confirmed that this patch fixed the problem by setting a checksum in the last
page in hash indexes, and pg_veviry_checksum is done successfully.  
regression=# select * from page_header(get_raw_page('hash_i4_index',65));
    lsn    | checksum | flags | lower | upper | special | pagesize | version | prune_xid 
-----------+----------+-------+-------+-------+---------+----------+---------+-----------
 0/41CACF0 |    18720 |     0 |    24 |  8176 |    8176 |     8192 |       4 |         0
(1 row)
By the way, I think we can fix this also by clearing the header information of the last
page instead of setting a checksum to the unused page although I am not sure which way
is better.
Regards,
-- 
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dilip Kumar | 2018-08-29 10:09:55 | Re: pg_verify_checksums failure with hash indexes | 
| Previous Message | Etsuro Fujita | 2018-08-29 09:40:03 | Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. |