Re: pageinspect: Hash index support

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pageinspect: Hash index support
Date: 2016-12-20 10:55:53
Message-ID: CAE9k0Pn0D_8khiKvg8PGUFpGDiiBi8Ok-qzVQwqW5WJKiZSLQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,

I have spent some time in reviewing the latest v8 patch from Jesper
and could find some issues which i would like to list down,

1) Firstly, the DATA section in the Makefile is referring to
"pageinspect--1.6.sql" file and currently this file is missing.

+DATA = pageinspect--1.6.sql pageinspect--1.5--1.6.sql

2) Secondly, I can see that the server is crashing when following
queries are executed on a code build with cassert-enabled.

postgres=# SELECT * FROM hash_page_items(get_raw_page('con_hash_index', 25000));
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> \q
[ashu(at)localhost bin]$ ./psql -d postgres
psql (10devel)
Type "help" for help.

postgres=# SELECT * FROM hash_page_stats(get_raw_page('con_hash_index', 25000));
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!> \q

postgres=# SELECT * FROM
hash_metapage_info(get_raw_page('con_hash_index', 25000));
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
!>

3) Thirdly, AFAIU the functions hash_page_stats() and
hash_page_items() are basically dedicated for bucket and overflow
pages in hash index and may not be used with bitmap page. It is
currently blocked for metapage but not for the bitmap page. I think we
need to block it for bitmap page as well.

Apart from issues listed above there are few other review comments
that has not been addressed yet. Considering the fact that it is a
very important project from hash index perspective and as there has
been no work being done on this project for quite some time, I thought
of working on it to close some of the open review comments along with
the issues found by myself. I would like to share the revised patch
which is based on Jesper's v8 patch. The patch has mainly following
following changes in it,

1) It introduces two new functions hash_page_type() and
hash_bitmap_info(). hash_page_type basically displays the type of hash
page whereas hash_bitmap_info() shows the status of a bit for a
particular overflow page in bitmap page of hash index.

2) The functions hash_page_stats() and hash_page_items() basically
shows the information about data stored in bucket and overflow pages
of hash index. If a metapage or bitmap page is passed as an input to
this function it throws an error saying "Expected page type:'' got:
''".

3) It also improves verify_hash_page() function to handle any type of
page in hash index. It is now being used as
verify_hash_page('raw_page', <page_type>) to verify if the page passed
to this function is of 'page_type' or not. Here page_type can be
LH_META_PAGE, LH_BUCKET_PAGE, LH_OVERFLOW_PAGE, LH_BITMAP_PAGE.

Attached is the revised patch. Please have a look and let me know your
feedback. I have also changed the status for this patch in the
upcoming commitfest to "needs review". Thanks.

Attachment Content-Type Size
0001-Add-support-for-hash-index-in-pageinspect-contrib-mo.patch text/x-patch 26.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-12-20 11:18:16 Re: BUG: pg_stat_statements query normalization issues with combined queries
Previous Message Andres Freund 2016-12-20 09:58:53 Re: Time to drop old-style (V0) functions?